mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-23 17:55:55 +02:00
Bugfix: Keep accepting new connections after getting WSAETIMEDOUT on a new connection request
This commit is contained in:
parent
de256fdb51
commit
13680eefa0
1 changed files with 5 additions and 5 deletions
|
@ -85,7 +85,7 @@ namespace SMBLibrary.Server
|
||||||
m_connectionManager.ReleaseAllConnections();
|
m_connectionManager.ReleaseAllConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method Accepts new connections
|
// This method accepts new connections
|
||||||
private void ConnectRequestCallback(IAsyncResult ar)
|
private void ConnectRequestCallback(IAsyncResult ar)
|
||||||
{
|
{
|
||||||
Socket listenerSocket = (Socket)ar.AsyncState;
|
Socket listenerSocket = (Socket)ar.AsyncState;
|
||||||
|
@ -101,11 +101,11 @@ namespace SMBLibrary.Server
|
||||||
}
|
}
|
||||||
catch (SocketException ex)
|
catch (SocketException ex)
|
||||||
{
|
{
|
||||||
const int WSAECONNRESET = 10054;
|
const int WSAECONNRESET = 10054; // The client may have closed the connection before we start to process the connection request.
|
||||||
// Client may have closed the connection before we start to process the connection request.
|
const int WSAETIMEDOUT = 10060; // The client did not properly respond after a period of time.
|
||||||
// When we get this error, we have to continue to accept other requests.
|
// When we get WSAECONNRESET or WSAETIMEDOUT, we have to continue to accept other connection requests.
|
||||||
// See http://stackoverflow.com/questions/7704417/socket-endaccept-error-10054
|
// See http://stackoverflow.com/questions/7704417/socket-endaccept-error-10054
|
||||||
if (ex.ErrorCode == WSAECONNRESET)
|
if (ex.ErrorCode == WSAECONNRESET || ex.ErrorCode == WSAETIMEDOUT)
|
||||||
{
|
{
|
||||||
listenerSocket.BeginAccept(ConnectRequestCallback, listenerSocket);
|
listenerSocket.BeginAccept(ConnectRequestCallback, listenerSocket);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue