mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-16 13:14:49 +00:00
Adds logging of the SocketErrorCode when arming WaitForConnectionAsync.
#8
This commit is contained in:
@@ -418,7 +418,17 @@ namespace PepperDash.Core
|
|||||||
SecureServer.PortNumber = Port;
|
SecureServer.PortNumber = Port;
|
||||||
}
|
}
|
||||||
ServerStopped = false;
|
ServerStopped = false;
|
||||||
SecureServer.WaitForConnectionAsync(IPAddress.Any, SecureConnectCallback);
|
|
||||||
|
// Start the listner
|
||||||
|
SocketErrorCodes status = SecureServer.WaitForConnectionAsync(IPAddress.Any, SecureConnectCallback);
|
||||||
|
if (status != SocketErrorCodes.SOCKET_OPERATION_PENDING)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Error starting WaitForConnectionAsync {0}", status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ServerStopped = false;
|
||||||
|
}
|
||||||
OnServerStateChange(SecureServer.State);
|
OnServerStateChange(SecureServer.State);
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Secure Server Status: {0}, Socket Status: {1}", SecureServer.State, SecureServer.ServerSocketStatus);
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Secure Server Status: {0}, Socket Status: {1}", SecureServer.State, SecureServer.ServerSocketStatus);
|
||||||
ServerCCSection.Leave();
|
ServerCCSection.Leave();
|
||||||
@@ -759,13 +769,6 @@ namespace PepperDash.Core
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Error, "Client attempt faulty.");
|
Debug.Console(1, this, Debug.ErrorLogLevel.Error, "Client attempt faulty.");
|
||||||
|
|
||||||
// JTA 2020-02-20
|
|
||||||
// There is an issue where on a failed negotiation we need to stop and start the server. This should still leave connected client intact.
|
|
||||||
server.Stop();
|
|
||||||
Listen();
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -773,24 +776,18 @@ namespace PepperDash.Core
|
|||||||
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Error in Socket Status Connect Callback. Error: {0}", ex);
|
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Error in Socket Status Connect Callback. Error: {0}", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
server.WaitForConnectionAsync(IPAddress.Any, SecureConnectCallback);
|
// Rearm the listner
|
||||||
|
SocketErrorCodes status = server.WaitForConnectionAsync(IPAddress.Any, SecureConnectCallback);
|
||||||
/*
|
if (status != SocketErrorCodes.SOCKET_OPERATION_PENDING)
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Error, "((((((Server State ={0} {3}; maxclient={1}; ServerStopped={2}))))))",
|
|
||||||
server.State,
|
|
||||||
MaxClients,
|
|
||||||
ServerStopped);
|
|
||||||
|
|
||||||
// JTA 2020-02-21 Im was not clear on why this condition was here. I think the WaitForCOnnection should always rearm.
|
|
||||||
|
|
||||||
if ((server.State & ServerState.SERVER_LISTENING) != ServerState.SERVER_LISTENING && MaxClients > 1 && !ServerStopped)
|
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Waiting for next connection");
|
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Socket status connect callback status {0}", status);
|
||||||
server.WaitForConnectionAsync(IPAddress.Any, SecureConnectCallback);
|
if (status == SocketErrorCodes.SOCKET_CONNECTION_IN_PROGRESS)
|
||||||
|
{
|
||||||
|
// There is an issue where on a failed negotiation we need to stop and start the server. This should still leave connected clients intact.
|
||||||
|
server.Stop();
|
||||||
|
Listen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user