Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
b2cfa69c
Commit
b2cfa69c
authored
Aug 24, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make style
parent
0b420448
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
70 additions
and
57 deletions
+70
-57
MBTCPMaster.cc
extensions/ModbusMaster/MBTCPMaster.cc
+1
-0
MBTCPMultiMaster.cc
extensions/ModbusMaster/MBTCPMultiMaster.cc
+1
-0
UNetReceiver.cc
extensions/UNetUDP/UNetReceiver.cc
+1
-1
UNetSender.cc
extensions/UNetUDP/UNetSender.cc
+6
-4
test_unetudp.cc
extensions/UNetUDP/tests/test_unetudp.cc
+4
-4
urecv_perf_test.cc
extensions/UNetUDP/tests/urecv_perf_test.cc
+1
-1
unet-udp-tester.cc
extensions/UNetUDP/unet-udp-tester.cc
+3
-3
UObject_SK.h
extensions/include/UObject_SK.h
+0
-0
UObject_SK.cc
extensions/lib/UObject_SK.cc
+0
-0
LogSession.h
include/LogSession.h
+1
-1
ThreadCreator.h
include/ThreadCreator.h
+1
-1
UDPCore.h
include/UDPCore.h
+2
-2
VMonitor.h
include/VMonitor.h
+1
-1
ModbusTCPMaster.cc
src/Communications/Modbus/ModbusTCPMaster.cc
+14
-10
TCPCheck.cc
src/Communications/TCP/TCPCheck.cc
+1
-1
USocket.cc
src/Communications/TCP/USocket.cc
+1
-1
UTCPSocket.cc
src/Communications/TCP/UTCPSocket.cc
+2
-2
UTCPStream.cc
src/Communications/TCP/UTCPStream.cc
+8
-7
LogReader.cc
src/Log/LogReader.cc
+7
-6
LogSession.cc
src/Log/LogSession.cc
+1
-1
IONotifyController.cc
src/Processes/IONotifyController.cc
+1
-0
Configuration.cc
src/Various/Configuration.cc
+1
-1
VMonitor.cc
src/Various/VMonitor.cc
+1
-1
poco-test.cc
tests/PocoTest/poco-test.cc
+8
-6
develop.cc
tests/develop.cc
+2
-2
test_tcpcheck.cc
tests/test_tcpcheck.cc
+1
-1
No files found.
extensions/ModbusMaster/MBTCPMaster.cc
View file @
b2cfa69c
...
...
@@ -224,6 +224,7 @@ void MBTCPMaster::sigterm( int signo )
bool
MBTCPMaster
::
deactivateObject
()
{
setProcActive
(
false
);
if
(
pollThread
)
{
pollThread
->
stop
();
...
...
extensions/ModbusMaster/MBTCPMultiMaster.cc
View file @
b2cfa69c
...
...
@@ -514,6 +514,7 @@ void MBTCPMultiMaster::sigterm( int signo )
bool
MBTCPMultiMaster
::
deactivateObject
()
{
setProcActive
(
false
);
if
(
pollThread
)
{
pollThread
->
stop
();
...
...
extensions/UNetUDP/UNetReceiver.cc
View file @
b2cfa69c
...
...
@@ -44,7 +44,7 @@ UNetReceiver::UNetReceiver(const std::string& s_host, int _port, const std::shar
recvpause
(
10
),
updatepause
(
100
),
port
(
_port
),
saddr
(
s_host
,
_port
),
saddr
(
s_host
,
_port
),
recvTimeout
(
5000
),
prepareTime
(
2000
),
lostTimeout
(
200
),
/* 2*updatepause */
...
...
extensions/UNetUDP/UNetSender.cc
View file @
b2cfa69c
...
...
@@ -35,7 +35,7 @@ UNetSender::UNetSender(const std::string& _host, const int _port, const std::sha
shm
(
smi
),
port
(
_port
),
s_host
(
_host
),
saddr
(
_host
,
_port
),
saddr
(
_host
,
_port
),
sendpause
(
150
),
packsendpause
(
5
),
activated
(
false
),
...
...
@@ -115,8 +115,8 @@ bool UNetSender::createConnection( bool throwEx )
//udp = make_shared<UDPSocketU>(addr, port);
udp
=
make_shared
<
UDPSocketU
>
();
udp
->
setBroadcast
(
true
);
udp
->
setSendTimeout
(
writeTimeout
*
1000
);
// udp->setNoDelay(true);
udp
->
setSendTimeout
(
writeTimeout
*
1000
);
// udp->setNoDelay(true);
}
catch
(
const
std
::
exception
&
e
)
{
...
...
@@ -305,13 +305,15 @@ void UNetSender::real_send( UniSetUDP::UDPMessage& mypack )
if
(
packetnum
==
0
)
packetnum
=
1
;
if
(
!
udp
||
!
udp
->
poll
(
writeTimeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
)
if
(
!
udp
||
!
udp
->
poll
(
writeTimeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
)
return
;
mypack
.
transport_msg
(
s_msg
);
try
{
size_t
ret
=
udp
->
sendTo
((
char
*
)
s_msg
.
data
,
s_msg
.
len
,
saddr
);
if
(
ret
<
s_msg
.
len
)
unetcrit
<<
myname
<<
"(real_send): FAILED ret="
<<
ret
<<
" < sizeof="
<<
s_msg
.
len
<<
endl
;
}
...
...
extensions/UNetUDP/tests/test_unetudp.cc
View file @
b2cfa69c
...
...
@@ -23,7 +23,7 @@ static int s_port = 3003; // Node2
static
int
s_nodeID
=
3003
;
static
int
s_procID
=
123
;
static
int
s_numpack
=
1
;
static
Poco
::
Net
::
SocketAddress
s_addr
(
host
,
s_port
);
static
Poco
::
Net
::
SocketAddress
s_addr
(
host
,
s_port
);
static
ObjectId
node2_respond_s
=
12
;
static
ObjectId
node2_lostpackets_as
=
13
;
static
int
maxDifferense
=
5
;
// см. unetudp-test-configure.xml --unet-maxdifferense
...
...
@@ -63,7 +63,7 @@ static UniSetUDP::UDPMessage receive( unsigned int pnum = 0, timeout_t tout = 20
while
(
ncycle
>
0
)
{
if
(
!
udp_r
->
poll
(
tout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
if
(
!
udp_r
->
poll
(
tout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
break
;
size_t
ret
=
udp_r
->
receiveBytes
(
&
(
buf
.
data
),
sizeof
(
buf
.
data
)
);
...
...
@@ -81,7 +81,7 @@ static UniSetUDP::UDPMessage receive( unsigned int pnum = 0, timeout_t tout = 20
// -----------------------------------------------------------------------------
void
send
(
UniSetUDP
::
UDPMessage
&
pack
,
int
tout
=
2000
)
{
CHECK
(
udp_s
->
poll
(
tout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
);
CHECK
(
udp_s
->
poll
(
tout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
);
pack
.
nodeID
=
s_nodeID
;
pack
.
procID
=
s_procID
;
...
...
@@ -89,7 +89,7 @@ void send( UniSetUDP::UDPMessage& pack, int tout = 2000 )
UniSetUDP
::
UDPPacket
s_buf
;
pack
.
transport_msg
(
s_buf
);
size_t
ret
=
udp_s
->
sendTo
((
char
*
)
&
s_buf
.
data
,
s_buf
.
len
,
s_addr
);
size_t
ret
=
udp_s
->
sendTo
((
char
*
)
&
s_buf
.
data
,
s_buf
.
len
,
s_addr
);
REQUIRE
(
ret
==
s_buf
.
len
);
}
// -----------------------------------------------------------------------------
...
...
extensions/UNetUDP/tests/urecv_perf_test.cc
View file @
b2cfa69c
...
...
@@ -107,7 +107,7 @@ static void run_senders( size_t max, const std::string& s_host, size_t count = 5
{
try
{
if
(
udp
->
poll
(
100000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
)
if
(
udp
->
poll
(
100000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
)
{
mypack
.
transport_msg
(
s_buf
);
size_t
ret
=
udp
->
sendBytes
((
char
*
)
&
s_buf
.
data
,
s_buf
.
len
);
...
...
extensions/UNetUDP/unet-udp-tester.cc
View file @
b2cfa69c
...
...
@@ -228,7 +228,7 @@ int main(int argc, char* argv[])
npack
=
0
;
}
if
(
!
udp
.
poll
(
tout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
if
(
!
udp
.
poll
(
tout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
{
cout
<<
"(recv): Timeout.."
<<
endl
;
continue
;
...
...
@@ -304,7 +304,7 @@ int main(int argc, char* argv[])
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
mypack
.
addDData
(
i
,
i
);
Poco
::
Net
::
SocketAddress
sa
(
s_host
,
port
);
Poco
::
Net
::
SocketAddress
sa
(
s_host
,
port
);
udp
->
connect
(
sa
);
size_t
packetnum
=
0
;
...
...
@@ -326,7 +326,7 @@ int main(int argc, char* argv[])
try
{
if
(
udp
->
poll
(
tout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
)
if
(
udp
->
poll
(
tout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
)
{
mypack
.
transport_msg
(
s_buf
);
...
...
extensions/include/UObject_SK.h
View file @
b2cfa69c
This diff is collapsed.
Click to expand it.
extensions/lib/UObject_SK.cc
View file @
b2cfa69c
This diff is collapsed.
Click to expand it.
include/LogSession.h
View file @
b2cfa69c
...
...
@@ -78,7 +78,7 @@ class LogSession
std
::
string
getShortInfo
();
protected
:
// LogSession( ost::TCPSocket& server );
// LogSession( ost::TCPSocket& server );
void
event
(
ev
::
async
&
watcher
,
int
revents
);
void
callback
(
ev
::
io
&
watcher
,
int
revents
);
...
...
include/ThreadCreator.h
View file @
b2cfa69c
...
...
@@ -147,7 +147,7 @@ class ThreadCreator:
(
initm
->*
initact
)();
}
virtual
void
terminate
(){}
virtual
void
terminate
()
{}
private
:
ThreadCreator
();
...
...
include/UDPCore.h
View file @
b2cfa69c
...
...
@@ -17,7 +17,7 @@ class UDPSocketU:
{}
UDPSocketU
(
const
std
::
string
&
bind
,
int
port
)
:
Poco
::
Net
::
DatagramSocket
(
Poco
::
Net
::
SocketAddress
(
bind
,
port
),
true
)
Poco
::
Net
::
DatagramSocket
(
Poco
::
Net
::
SocketAddress
(
bind
,
port
),
true
)
{}
virtual
~
UDPSocketU
()
{}
...
...
@@ -38,7 +38,7 @@ class UDPReceiveU:
{}
UDPReceiveU
(
const
std
::
string
&
bind
,
int
port
)
:
Poco
::
Net
::
DatagramSocket
(
Poco
::
Net
::
SocketAddress
(
bind
,
port
),
true
)
Poco
::
Net
::
DatagramSocket
(
Poco
::
Net
::
SocketAddress
(
bind
,
port
),
true
)
{}
virtual
~
UDPReceiveU
()
{}
...
...
include/VMonitor.h
View file @
b2cfa69c
...
...
@@ -158,7 +158,7 @@ class VMonitor
VMON_DEF_MAP
(
bool
);
VMON_DEF_MAP
(
float
);
VMON_DEF_MAP
(
double
);
std
::
unordered_map
<
const
Poco
::
Int64
*
,
const
std
::
string
>
m_Int64
;
std
::
unordered_map
<
const
Poco
::
Int64
*
,
const
std
::
string
>
m_Int64
;
VMON_DEF_MAP3
(
std
::
string
,
string
);
};
// --------------------------------------------------------------------------
...
...
src/Communications/Modbus/ModbusTCPMaster.cc
View file @
b2cfa69c
...
...
@@ -36,7 +36,7 @@ ModbusTCPMaster::ModbusTCPMaster():
{
setCRCNoCheckit
(
true
);
// dlog->level(Debug::ANY);
// dlog->level(Debug::ANY);
}
// -------------------------------------------------------------------------
...
...
@@ -61,7 +61,7 @@ void ModbusTCPMaster::setChannelTimeout( timeout_t msec )
Poco
::
Timespan
old
=
tcp
->
getReceiveTimeout
();;
//timeout_t old = tcp->getReceiveTimeout();
Poco
::
Timespan
tmsec
(
msec
*
1000
);
Poco
::
Timespan
tmsec
(
msec
*
1000
);
if
(
old
==
msec
)
return
;
...
...
@@ -114,14 +114,14 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
assert
(
timeout
);
ptTimeout
.
setTiming
(
timeout
);
tcp
->
setReceiveTimeout
(
timeout
*
1000
);
tcp
->
setReceiveTimeout
(
timeout
*
1000
);
msg
.
makeHead
(
++
nTransaction
,
crcNoCheckit
);
for
(
size_t
i
=
0
;
i
<
2
;
i
++
)
{
//if( tcp->isPending(ost::Socket::pendingOutput, timeout) )
if
(
tcp
->
poll
(
timeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
)
if
(
tcp
->
poll
(
timeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
)
{
mbErrCode
res
=
send
(
msg
);
...
...
@@ -167,7 +167,7 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
//tcp->sync();
if
(
tcp
->
poll
(
timeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
if
(
tcp
->
poll
(
timeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
{
size_t
ret
=
0
;
...
...
@@ -211,6 +211,7 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
dlog->warn() << "(query): tcp error: " << e.getString() << endl;
}
}
#endif
cleanInputStream
();
tcp
->
forceDisconnect
();
...
...
@@ -385,7 +386,7 @@ void ModbusTCPMaster::reconnect()
{
tcp
=
make_shared
<
UTCPStream
>
();
tcp
->
create
(
iaddr
,
port
,
500
);
tcp
->
setReceiveTimeout
(
replyTimeOut_ms
*
1000
);
tcp
->
setReceiveTimeout
(
replyTimeOut_ms
*
1000
);
tcp
->
setKeepAliveParams
((
replyTimeOut_ms
>
1000
?
replyTimeOut_ms
/
1000
:
1
));
tcp
->
setNoDelay
(
true
);
}
...
...
@@ -411,7 +412,7 @@ void ModbusTCPMaster::reconnect()
// -------------------------------------------------------------------------
void
ModbusTCPMaster
::
connect
(
const
std
::
string
&
addr
,
int
_port
)
{
Net
::
SocketAddress
sa
(
addr
,
_port
);
Net
::
SocketAddress
sa
(
addr
,
_port
);
connect
(
sa
,
_port
);
}
// -------------------------------------------------------------------------
...
...
@@ -433,9 +434,9 @@ void ModbusTCPMaster::connect( const Poco::Net::SocketAddress& addr, int _port )
try
{
tcp
=
make_shared
<
UTCPStream
>
();
tcp
->
create
(
iaddr
,
port
,
500
);
tcp
->
create
(
iaddr
,
port
,
500
);
//tcp->connect(addr,500);
tcp
->
setReceiveTimeout
(
replyTimeOut_ms
*
1000
);
tcp
->
setReceiveTimeout
(
replyTimeOut_ms
*
1000
);
tcp
->
setKeepAlive
(
true
);
// tcp->setKeepAliveParams((replyTimeOut_ms > 1000 ? replyTimeOut_ms / 1000 : 1));
tcp
->
setNoDelay
(
true
);
}
...
...
@@ -458,6 +459,7 @@ void ModbusTCPMaster::connect( const Poco::Net::SocketAddress& addr, int _port )
s
<<
"(ModbusTCPMaster): connection "
<<
iaddr
<<
":"
<<
port
<<
" error: "
<<
e
.
what
();
dlog
->
crit
()
<<
iaddr
<<
std
::
endl
;
}
tcp
=
nullptr
;
}
catch
(
...
)
...
...
@@ -468,6 +470,7 @@ void ModbusTCPMaster::connect( const Poco::Net::SocketAddress& addr, int _port )
s
<<
"(ModbusTCPMaster): connection "
<<
iaddr
<<
":"
<<
port
<<
" error: catch ..."
;
dlog
->
crit
()
<<
s
.
str
()
<<
std
::
endl
;
}
tcp
=
nullptr
;
}
}
...
...
@@ -500,10 +503,11 @@ bool ModbusTCPMaster::isConnection() const
{
return
tcp
&&
tcp
->
isConnected
();
#if 0
if( !tcp )
return false;
if( tcp->poll({0,
5},
Poco::Net::Socket::SELECT_READ) )
if( tcp->poll({0,
5},
Poco::Net::Socket::SELECT_READ) )
return (tcp->available() > 0);
return false;
...
...
src/Communications/TCP/TCPCheck.cc
View file @
b2cfa69c
...
...
@@ -52,7 +52,7 @@ bool TCPCheck::check( const std::string& _ip, int _port, timeout_t tout, timeout
setResult
(
false
);
ThreadCreator
<
TCPCheck
>
t
(
this
,
&
TCPCheck
::
check_thread
);
// t.setCancel(ost::Thread::cancelDeferred);
// t.setCancel(ost::Thread::cancelDeferred);
t
.
start
();
PassiveTimer
pt
(
tout
);
...
...
src/Communications/TCP/USocket.cc
View file @
b2cfa69c
...
...
@@ -28,7 +28,7 @@ void USocket::init( bool throwflag )
{
//setError(throwflag);
setKeepAlive
(
true
);
Socket
::
setLinger
(
true
,
1
);
Socket
::
setLinger
(
true
,
1
);
//setLinger(true);
setKeepAliveParams
();
}
...
...
src/Communications/TCP/UTCPSocket.cc
View file @
b2cfa69c
...
...
@@ -27,7 +27,7 @@ UTCPSocket::UTCPSocket( int sock ):
}
// -------------------------------------------------------------------------
UTCPSocket
::
UTCPSocket
(
const
string
&
host
,
int
port
)
:
Poco
::
Net
::
ServerSocket
(
Poco
::
Net
::
SocketAddress
(
host
,
port
),
true
)
Poco
::
Net
::
ServerSocket
(
Poco
::
Net
::
SocketAddress
(
host
,
port
),
true
)
{
init
();
}
...
...
@@ -45,7 +45,7 @@ int UTCPSocket::getSocket()
void
UTCPSocket
::
init
()
{
Poco
::
Net
::
ServerSocket
::
setKeepAlive
(
true
);
Poco
::
Net
::
ServerSocket
::
setLinger
(
true
,
1
);
Poco
::
Net
::
ServerSocket
::
setLinger
(
true
,
1
);
setKeepAliveParams
();
}
// -------------------------------------------------------------------------
src/Communications/TCP/UTCPStream.cc
View file @
b2cfa69c
...
...
@@ -51,7 +51,7 @@ bool UTCPStream::isSetLinger() const
{
bool
on
;
int
sec
;
Poco
::
Net
::
StreamSocket
::
getLinger
(
on
,
sec
);
Poco
::
Net
::
StreamSocket
::
getLinger
(
on
,
sec
);
return
on
;
}
// -------------------------------------------------------------------------
...
...
@@ -61,11 +61,11 @@ void UTCPStream::forceDisconnect()
{
bool
on
;
int
sec
;
Poco
::
Net
::
StreamSocket
::
getLinger
(
on
,
sec
);
setLinger
(
false
,
0
);
Poco
::
Net
::
StreamSocket
::
getLinger
(
on
,
sec
);
setLinger
(
false
,
0
);
close
();
//shutdown();
Poco
::
Net
::
StreamSocket
::
setLinger
(
on
,
sec
);
Poco
::
Net
::
StreamSocket
::
setLinger
(
on
,
sec
);
}
catch
(
Poco
::
Net
::
NetException
&
)
{
...
...
@@ -86,10 +86,10 @@ timeout_t UTCPStream::getTimeout() const
// -------------------------------------------------------------------------
void
UTCPStream
::
create
(
const
std
::
string
&
hname
,
int
port
,
timeout_t
tout_msec
)
{
Poco
::
Net
::
SocketAddress
sa
(
hname
,
port
);
connect
(
sa
,
tout_msec
*
1000
);
Poco
::
Net
::
SocketAddress
sa
(
hname
,
port
);
connect
(
sa
,
tout_msec
*
1000
);
setKeepAlive
(
true
);
Poco
::
Net
::
StreamSocket
::
setLinger
(
true
,
1
);
Poco
::
Net
::
StreamSocket
::
setLinger
(
true
,
1
);
setKeepAliveParams
();
}
// -------------------------------------------------------------------------
...
...
@@ -103,6 +103,7 @@ bool UTCPStream::isConnected()
catch
(
Poco
::
Net
::
NetException
&
ex
)
{
}
return
false
;
}
// -------------------------------------------------------------------------
src/Log/LogReader.cc
View file @
b2cfa69c
...
...
@@ -78,8 +78,8 @@ void LogReader::connect( const std::string& _addr, int _port, timeout_t msec )
{
tcp
=
make_shared
<
UTCPStream
>
();
tcp
->
create
(
iaddr
,
port
,
msec
);
tcp
->
setReceiveTimeout
(
inTimeout
*
1000
);
tcp
->
setSendTimeout
(
outTimeout
*
1000
);
tcp
->
setReceiveTimeout
(
inTimeout
*
1000
);
tcp
->
setSendTimeout
(
outTimeout
*
1000
);
tcp
->
setKeepAlive
(
true
);
tcp
->
setBlocking
(
true
);
}
...
...
@@ -91,6 +91,7 @@ void LogReader::connect( const std::string& _addr, int _port, timeout_t msec )
s
<<
"(LogReader): connection "
<<
s
.
str
()
<<
" timeout.."
;
rlog
.
crit
()
<<
s
.
str
()
<<
std
::
endl
;
}
tcp
=
0
;
}
catch
(
const
Poco
::
Net
::
NetException
&
e
)
...
...
@@ -253,7 +254,7 @@ void LogReader::sendCommand(const std::string& _addr, int _port, std::vector<Com
{
int
a
=
2
;
while
(
a
>
0
&&
tcp
->
poll
(
reply_timeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
while
(
a
>
0
&&
tcp
->
poll
(
reply_timeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
{
int
n
=
tcp
->
available
();
...
...
@@ -335,7 +336,7 @@ void LogReader::readlogs( const std::string& _addr, int _port, LogServerTypes::C
send_ok
=
true
;
}
while
(
tcp
->
poll
(
inTimeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
while
(
tcp
->
poll
(
inTimeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
{
ssize_t
n
=
tcp
->
available
();
...
...
@@ -396,10 +397,10 @@ void LogReader::sendCommand(LogServerTypes::lsMessage& msg, bool verbose )
try
{
if
(
tcp
->
poll
(
outTimeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
)
if
(
tcp
->
poll
(
outTimeout
*
1000
,
Poco
::
Net
::
Socket
::
SELECT_WRITE
)
)
{
rlog
.
info
()
<<
"(LogReader): ** send command: cmd='"
<<
msg
.
cmd
<<
"' logname='"
<<
msg
.
logname
<<
"' data='"
<<
msg
.
data
<<
"'"
<<
endl
;
tcp
->
sendBytes
((
unsigned
char
*
)(
&
msg
),
sizeof
(
msg
));
tcp
->
sendBytes
((
unsigned
char
*
)(
&
msg
),
sizeof
(
msg
));
}
else
rlog
.
warn
()
<<
"(LogReader): **** SEND COMMAND ('"
<<
msg
.
cmd
<<
"' FAILED!"
<<
endl
;
...
...
src/Log/LogSession.cc
View file @
b2cfa69c
...
...
@@ -336,7 +336,7 @@ size_t LogSession::readData( unsigned char* buf, int len )
{
return
0
;
}
catch
(
Poco
::
Net
::
ConnectionResetException
&
ex
)
catch
(
Poco
::
Net
::
ConnectionResetException
&
ex
)
{
}
...
...
src/Processes/IONotifyController.cc
View file @
b2cfa69c
...
...
@@ -104,6 +104,7 @@ SimpleInfo* IONotifyController::getInfo( ::CORBA::Long userparam )
if
(
userparam
==
2
)
{
bool
ok
=
false
;
for
(
const
auto
&
c
:
i
.
clst
)
{
if
(
c
.
lostEvents
>
0
)
...
...
src/Various/Configuration.cc
View file @
b2cfa69c
...
...
@@ -1293,7 +1293,7 @@ namespace UniSetTypes
}
// инициализация исключений для libcommoncpp
// ost::Thread::setException(ost::Thread::throwException);
// ost::Thread::setException(ost::Thread::throwException);
atexit
(
UniSetActivator
::
normalexit
);
set_terminate
(
UniSetActivator
::
normalterminate
);
// ловушка для неизвестных исключений
...
...
src/Various/VMonitor.cc
View file @
b2cfa69c
...
...
@@ -137,7 +137,7 @@ VMON_IMPL_ADD2(char)
VMON_IMPL_ADD
(
bool
)
VMON_IMPL_ADD
(
float
)
VMON_IMPL_ADD
(
double
)
VMON_IMPL_ADD_N
(
Poco
::
Int64
,
m_Int64
)
VMON_IMPL_ADD_N
(
Poco
::
Int64
,
m_Int64
)
VMON_IMPL_ADD3
(
std
::
string
,
string
)
//VMON_IMPL_ADD3(UniSetTypes::ObjectId,ObjectId)
// --------------------------------------------------------------------------
...
...
tests/PocoTest/poco-test.cc
View file @
b2cfa69c
...
...
@@ -17,27 +17,29 @@ int main(int argc, const char** argv)
Net
::
StreamSocket
socket
(
sa
);
Net
::
SocketStream
str
(
socket
);
str
<<
"GET / HTTP/1.1
\r\n
"
"Host: habrahabr.ru
\r\n
"
"
\r\n
"
;
"Host: habrahabr.ru
\r\n
"
"
\r\n
"
;
str
.
flush
();
StreamCopier
::
copyStream
(
str
,
cout
);
//Слушающий сокет
Net
::
ServerSocket
srv
(
8080
);
// Биндим и начинаем слушать
while
(
true
)
{
Net
::
StreamSocket
ss
=
srv
.
acceptConnection
();
{
Net
::
SocketStream
str
(
ss
);
str
<<
"HTTP/1.0 200 OK
\r\n
"
"Content-Type: text/html
\r\n
"
"
\r\n
"
"<html><head><title>Доброго времени суток</title></head>"
"<body><h1><a href=
\"
http://habrahabr.ru
\"
>Добро пожаловать на Хабр.</a></h1></body></html>"
"Content-Type: text/html
\r\n
"
"
\r\n
"
"<html><head><title>Доброго времени суток</title></head>"
"<body><h1><a href=
\"
http://habrahabr.ru
\"
>Добро пожаловать на Хабр.</a></h1></body></html>"
<<
flush
;
}
}
return
0
;
}
catch
(
const
std
::
exception
&
e
)
...
...
tests/develop.cc
View file @
b2cfa69c
...
...
@@ -32,13 +32,13 @@ class PtrMapHashFn
int
main
(
int
argc
,
const
char
**
argv
)
{
unordered_map
<
const
long
*
,
const
long
*
,
PtrMapHashFn
>
vmap
;
unordered_map
<
const
long
*
,
const
long
*
,
PtrMapHashFn
>
vmap
;
const
long
id
=
10
;
long
prive_val
=
100
;
const
long
&
val
(
prive_val
);
vmap
.
emplace
(
&
id
,
&
val
);
vmap
.
emplace
(
&
id
,
&
val
);
auto
i
=
vmap
.
find
(
&
id
);
...
...
tests/test_tcpcheck.cc
View file @
b2cfa69c
...
...
@@ -20,7 +20,7 @@ bool run_test_server()
while
(
!
cancel
)
{
if
(
sock
.
poll
(
500000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
if
(
sock
.
poll
(
500000
,
Poco
::
Net
::
Socket
::
SELECT_READ
)
)
{
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment