Skip to content

Commit

Permalink
optimized the code about listner closure
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryjiang committed Jan 6, 2025
1 parent eb1aacf commit 0c87300
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/SuperSocket.Server/Connection/TcpConnectionListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ private async Task KeepAccept(Socket listenSocket)
{
var errorCode = se.ErrorCode;

//The listen socket was closed
if (errorCode == 125 || errorCode == 89 || errorCode == 995 || errorCode == 10004 || errorCode == 10038)
if (errorCode == 89 // System.Net.Sockets.SocketException (89): Operation canceled (MacOs)
|| errorCode == 125 // System.Net.Sockets.SocketException (125): Operation canceled
|| errorCode == 995 // System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request
|| errorCode == 10004) // System.Net.Sockets.SocketException (10004): A blocking Socket call was canceled.
{
_logger.LogCritical(se, $"The listener[{this.ToString()}] was closed for the socket error: {errorCode}.");
_logger.LogWarning(se, $"The listener[{this.ToString()}] was closed for the socket error: {errorCode}.");
break;
}
}
Expand Down

0 comments on commit 0c87300

Please sign in to comment.