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
8aeaf1de
Commit
8aeaf1de
authored
May 04, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Прошёлся по вылавливаниям исключений. Добавил ловушку для std::exception
parent
d9586f64
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
29 deletions
+36
-29
mbtcpserver.cc
Utilities/MBTester/mbtcpserver.cc
+2
-2
mbtcptester.cc
Utilities/MBTester/mbtcptester.cc
+2
-2
mbslave.cc
extensions/ModbusSlave/mbslave.cc
+2
-2
smemory.cc
extensions/SharedMemory/smemory.cc
+6
-2
UNetReceiver.cc
extensions/UNet2/UNetReceiver.cc
+4
-4
UNetSender.cc
extensions/UNet2/UNetSender.cc
+4
-0
unet2-tester.cc
extensions/UNet2/unet2-tester.cc
+2
-3
ModbusTCPServer.cc
src/Communications/Modbus/ModbusTCPServer.cc
+14
-14
No files found.
Utilities/MBTester/mbtcpserver.cc
View file @
8aeaf1de
...
...
@@ -113,9 +113,9 @@ int main( int argc, char **argv )
{
cerr
<<
"(mbtcpserver): "
<<
ex
<<
endl
;
}
catch
(
ost
::
SockException
&
e
)
catch
(
std
::
exception
&
e
)
{
cerr
<<
e
.
getString
()
<<
": "
<<
e
.
getSystemErrorString
()
<<
endl
;
cerr
<<
"(mbtcpserver): "
<<
e
.
what
()
<<
endl
;
}
catch
(...)
{
...
...
Utilities/MBTester/mbtcptester.cc
View file @
8aeaf1de
...
...
@@ -423,9 +423,9 @@ int main( int argc, char **argv )
{
cerr
<<
"(mbtester): "
<<
ex
<<
endl
;
}
catch
(
ost
::
SockException
&
e
)
catch
(
std
::
exception
&
e
)
{
cerr
<<
e
.
getString
()
<<
": "
<<
e
.
getSystemErrorString
()
<<
endl
;
cerr
<<
"(mbtester): "
<<
e
.
what
()
<<
endl
;
}
catch
(...)
{
...
...
extensions/ModbusSlave/mbslave.cc
View file @
8aeaf1de
...
...
@@ -86,9 +86,9 @@ int main(int argc, const char **argv)
{
dlog
[
Debug
::
CRIT
]
<<
"(mbslave): "
<<
ex
<<
endl
;
}
catch
(
ost
::
SockE
xception
&
e
)
catch
(
std
::
e
xception
&
e
)
{
dlog
[
Debug
::
CRIT
]
<<
e
.
getString
()
<<
": "
<<
e
.
getSystemErrorString
()
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(mbslave): "
<<
e
.
what
()
<<
endl
;
}
catch
(...)
{
...
...
extensions/SharedMemory/smemory.cc
View file @
8aeaf1de
...
...
@@ -42,14 +42,18 @@ int main(int argc, const char **argv)
// pause(); // пауза, чтобы дочерние потоки успели завершить работу
return
0
;
}
catch
(
SystemError
&
err
)
catch
(
SystemError
&
err
)
{
unideb
[
Debug
::
CRIT
]
<<
"(smemory): "
<<
err
<<
endl
;
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
unideb
[
Debug
::
CRIT
]
<<
"(smemory): "
<<
ex
<<
endl
;
}
catch
(
std
::
exception
&
e
)
{
unideb
[
Debug
::
CRIT
]
<<
"(smemory): "
<<
e
.
what
()
<<
endl
;
}
catch
(...)
{
unideb
[
Debug
::
CRIT
]
<<
"(smemory): catch(...)"
<<
endl
;
...
...
extensions/UNet2/UNetReceiver.cc
View file @
8aeaf1de
...
...
@@ -259,14 +259,14 @@ void UNetReceiver::receive()
if
(
recv
()
)
ptRecvTimeout
.
reset
();
}
catch
(
ost
::
SockException
&
e
)
{
dlog
[
Debug
::
WARN
]
<<
myname
<<
"(receive): "
<<
e
.
getString
()
<<
endl
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
dlog
[
Debug
::
WARN
]
<<
myname
<<
"(receive): "
<<
ex
<<
std
::
endl
;
}
catch
(
std
::
exception
&
e
)
{
dlog
[
Debug
::
WARN
]
<<
myname
<<
"(receive): "
<<
e
.
what
()
<<
std
::
endl
;
}
catch
(...)
{
dlog
[
Debug
::
WARN
]
<<
myname
<<
"(receive): catch ..."
<<
std
::
endl
;
...
...
extensions/UNet2/UNetSender.cc
View file @
8aeaf1de
...
...
@@ -161,6 +161,10 @@ void UNetSender::send()
{
dlog
[
Debug
::
WARN
]
<<
myname
<<
"(send): "
<<
ex
<<
std
::
endl
;
}
catch
(
std
::
exception
&
e
)
{
dlog
[
Debug
::
WARN
]
<<
myname
<<
"(send): "
<<
e
.
what
()
<<
std
::
endl
;
}
catch
(...)
{
dlog
[
Debug
::
WARN
]
<<
myname
<<
"(send): catch ..."
<<
std
::
endl
;
...
...
extensions/UNet2/unet2-tester.cc
View file @
8aeaf1de
...
...
@@ -289,10 +289,9 @@ int main(int argc, char* argv[])
break
;
}
}
catch
(
ost
::
SockE
xception
&
e
)
catch
(
std
::
e
xception
&
e
)
{
cerr
<<
"(main): "
<<
e
.
getString
()
<<
" ("
<<
addr
<<
")"
<<
endl
;
return
1
;
cerr
<<
"(main): "
<<
e
.
what
()
<<
endl
;
}
catch
(
...
)
{
...
...
src/Communications/Modbus/ModbusTCPServer.cc
View file @
8aeaf1de
...
...
@@ -104,8 +104,8 @@ mbErrCode ModbusTCPServer::receive( ModbusRTU::ModbusAddr addr, timeout_t timeou
send
(
buf
);
printProcessingTime
();
}
else
if
(
aftersend_msec
>=
0
)
msleep
(
aftersend_msec
);
else
if
(
aftersend_msec
>=
0
)
msleep
(
aftersend_msec
);
tcp
.
disconnect
();
return
res
;
...
...
@@ -135,9 +135,9 @@ mbErrCode ModbusTCPServer::receive( ModbusRTU::ModbusAddr addr, timeout_t timeou
tcp
.
disconnect
();
}
}
catch
(
ost
::
Sock
Exception
&
e
)
catch
(
ost
::
Exception
&
e
)
{
cout
<<
e
.
getString
()
<<
": "
<<
e
.
getSystemErrorString
()
<<
endl
;
cout
<<
"(ModbusTCPServer): "
<<
e
.
what
()
<<
endl
;
return
erInternalErrorCode
;
}
...
...
@@ -225,16 +225,16 @@ mbErrCode ModbusTCPServer::pre_send_request( ModbusMessage& request )
return
erNoError
;
}
// -------------------------------------------------------------------------
void
ModbusTCPServer
::
cleanInputStream
()
{
unsigned
char
buf
[
100
];
int
ret
=
0
;
do
{
ret
=
getNextData
(
buf
,
sizeof
(
buf
));
}
while
(
ret
>
0
);
}
void
ModbusTCPServer
::
cleanInputStream
()
{
unsigned
char
buf
[
100
];
int
ret
=
0
;
do
{
ret
=
getNextData
(
buf
,
sizeof
(
buf
));
}
while
(
ret
>
0
);
}
// -------------------------------------------------------------------------
void
ModbusTCPServer
::
terminate
()
{
...
...
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