fix exception during teardown of tcp listener

This commit is contained in:
Martin Regen
2016-09-01 12:38:49 +02:00
parent ede936d590
commit 771fc5809a
+14 -11
View File
@@ -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.");
}
}
}
}