mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-23 10:23:13 +08:00
fix exception during teardown of tcp listener
This commit is contained in:
@@ -342,17 +342,20 @@ namespace Opc.Ua.Bindings
|
||||
|
||||
e.Dispose();
|
||||
|
||||
// go back and wait for the next connection.
|
||||
try
|
||||
{
|
||||
e = new SocketAsyncEventArgs();
|
||||
e.Completed += OnAccept;
|
||||
e.UserToken = listeningSocket;
|
||||
listeningSocket.AcceptAsync(e);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.Trace(ex, "Unexpected error listening for a new connection.");
|
||||
if (e.SocketError != SocketError.OperationAborted)
|
||||
{
|
||||
// go back and wait for the next connection.
|
||||
try
|
||||
{
|
||||
e = new SocketAsyncEventArgs();
|
||||
e.Completed += OnAccept;
|
||||
e.UserToken = listeningSocket;
|
||||
listeningSocket.AcceptAsync(e);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.Trace(ex, "Unexpected error listening for a new connection.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user