Really removes general status debug messages from level 1 to level 2 in Tcp Clients for Server

This commit is contained in:
Jason T Alborough
2019-11-12 17:26:15 -05:00
parent aa0ec2684c
commit fa2feb698c
2 changed files with 24 additions and 24 deletions

View File

@@ -370,7 +370,7 @@ namespace PepperDash.Core
public void Connect() public void Connect()
{ {
ConnectionCount++; ConnectionCount++;
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Attempting connect Count:{0}", ConnectionCount); Debug.Console(2, this, "Attempting connect Count:{0}", ConnectionCount);
if (IsConnected) if (IsConnected)
@@ -440,10 +440,10 @@ namespace PepperDash.Core
} }
}, 30000); }, 30000);
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Making Connection Count:{0}", ConnectionCount); Debug.Console(2, this, "Making Connection Count:{0}", ConnectionCount);
Client.ConnectToServerAsync(o => Client.ConnectToServerAsync(o =>
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "ConnectToServerAsync Count:{0} Ran!", ConnectionCount); Debug.Console(2, this, "ConnectToServerAsync Count:{0} Ran!", ConnectionCount);
if (ConnectFailTimer != null) if (ConnectFailTimer != null)
{ {
@@ -453,7 +453,7 @@ namespace PepperDash.Core
if (o.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED) if (o.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED)
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Client connected to {0} on port {1}", o.AddressClientConnectedTo, o.LocalPortNumberOfClient); Debug.Console(2, this, "Client connected to {0} on port {1}", o.AddressClientConnectedTo, o.LocalPortNumberOfClient);
o.ReceiveDataAsync(Receive); o.ReceiveDataAsync(Receive);
if (SharedKeyRequired) if (SharedKeyRequired)
@@ -526,7 +526,7 @@ namespace PepperDash.Core
if (Client != null) if (Client != null)
{ {
//SecureClient.DisconnectFromServer(); //SecureClient.DisconnectFromServer();
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Disconnecting Client {0}", DisconnectCalledByUser ? ", Called by user" : ""); Debug.Console(2, this, "Disconnecting Client {0}", DisconnectCalledByUser ? ", Called by user" : "");
Client.SocketStatusChange -= Client_SocketStatusChange; Client.SocketStatusChange -= Client_SocketStatusChange;
Client.Dispose(); Client.Dispose();
Client = null; Client = null;
@@ -548,14 +548,14 @@ namespace PepperDash.Core
{ {
if (Client != null) if (Client != null)
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Cleaning up remotely closed/failed connection."); Debug.Console(2, this, "Cleaning up remotely closed/failed connection.");
Cleanup(); Cleanup();
} }
if (!DisconnectCalledByUser && AutoReconnect) if (!DisconnectCalledByUser && AutoReconnect)
{ {
var halfInterval = AutoReconnectIntervalMs / 2; var halfInterval = AutoReconnectIntervalMs / 2;
var rndTime = new Random().Next(-halfInterval, halfInterval) + AutoReconnectIntervalMs; var rndTime = new Random().Next(-halfInterval, halfInterval) + AutoReconnectIntervalMs;
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Attempting reconnect in {0} ms, randomized", rndTime); Debug.Console(2, this, "Attempting reconnect in {0} ms, randomized", rndTime);
if (RetryTimer != null) if (RetryTimer != null)
{ {
RetryTimer.Stop(); RetryTimer.Stop();
@@ -596,7 +596,7 @@ namespace PepperDash.Core
StopWaitForSharedKeyTimer(); StopWaitForSharedKeyTimer();
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Shared key confirmed. Ready for communication"); Debug.Console(2, this, "Shared key confirmed. Ready for communication");
OnClientReadyForcommunications(true); // Successful key exchange OnClientReadyForcommunications(true); // Successful key exchange
} }
else else
@@ -669,7 +669,7 @@ namespace PepperDash.Core
{ {
if (HeartbeatEnabled) if (HeartbeatEnabled)
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Starting Heartbeat"); Debug.Console(2, this, "Starting Heartbeat");
if (HeartbeatSendTimer == null) if (HeartbeatSendTimer == null)
{ {
@@ -687,13 +687,13 @@ namespace PepperDash.Core
if (HeartbeatSendTimer != null) if (HeartbeatSendTimer != null)
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Stoping Heartbeat Send"); Debug.Console(2, this, "Stoping Heartbeat Send");
HeartbeatSendTimer.Stop(); HeartbeatSendTimer.Stop();
HeartbeatSendTimer = null; HeartbeatSendTimer = null;
} }
if (HeartbeatAckTimer != null) if (HeartbeatAckTimer != null)
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Stoping Heartbeat Ack"); Debug.Console(2, this, "Stoping Heartbeat Ack");
HeartbeatAckTimer.Stop(); HeartbeatAckTimer.Stop();
HeartbeatAckTimer = null; HeartbeatAckTimer = null;
} }
@@ -835,7 +835,7 @@ namespace PepperDash.Core
} }
try try
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Socket status change: {0} ({1})", client.ClientStatus, (ushort)(client.ClientStatus)); Debug.Console(2, this, "Socket status change: {0} ({1})", client.ClientStatus, (ushort)(client.ClientStatus));
OnConnectionChange(); OnConnectionChange();
// The client could be null or disposed by this time... // The client could be null or disposed by this time...

View File

@@ -282,7 +282,7 @@ namespace PepperDash.Core
public void Connect() public void Connect()
{ {
ConnectionCount++; ConnectionCount++;
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Attempting connect Count:{0}", ConnectionCount); Debug.Console(2, this, "Attempting connect Count:{0}", ConnectionCount);
if (IsConnected) if (IsConnected)
@@ -352,10 +352,10 @@ namespace PepperDash.Core
} }
}, 30000); }, 30000);
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Making Connection Count:{0}", ConnectionCount); Debug.Console(2, this, "Making Connection Count:{0}", ConnectionCount);
Client.ConnectToServerAsync(o => Client.ConnectToServerAsync(o =>
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "ConnectToServerAsync Count:{0} Ran!", ConnectionCount); Debug.Console(2, this, "ConnectToServerAsync Count:{0} Ran!", ConnectionCount);
if (ConnectFailTimer != null) if (ConnectFailTimer != null)
{ {
@@ -365,7 +365,7 @@ namespace PepperDash.Core
if (o.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED) if (o.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED)
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Client connected to {0} on port {1}", o.AddressClientConnectedTo, o.LocalPortNumberOfClient); Debug.Console(2, this, "Client connected to {0} on port {1}", o.AddressClientConnectedTo, o.LocalPortNumberOfClient);
o.ReceiveDataAsync(Receive); o.ReceiveDataAsync(Receive);
if (SharedKeyRequired) if (SharedKeyRequired)
@@ -438,7 +438,7 @@ namespace PepperDash.Core
if (Client != null) if (Client != null)
{ {
//SecureClient.DisconnectFromServer(); //SecureClient.DisconnectFromServer();
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Disconnecting Client {0}", DisconnectCalledByUser ? ", Called by user" : ""); Debug.Console(2, this, "Disconnecting Client {0}", DisconnectCalledByUser ? ", Called by user" : "");
Client.SocketStatusChange -= Client_SocketStatusChange; Client.SocketStatusChange -= Client_SocketStatusChange;
Client.Dispose(); Client.Dispose();
Client = null; Client = null;
@@ -460,14 +460,14 @@ namespace PepperDash.Core
{ {
if (Client != null) if (Client != null)
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Cleaning up remotely closed/failed connection."); Debug.Console(2, this, "Cleaning up remotely closed/failed connection.");
Cleanup(); Cleanup();
} }
if (!DisconnectCalledByUser && AutoReconnect) if (!DisconnectCalledByUser && AutoReconnect)
{ {
var halfInterval = AutoReconnectIntervalMs / 2; var halfInterval = AutoReconnectIntervalMs / 2;
var rndTime = new Random().Next(-halfInterval, halfInterval) + AutoReconnectIntervalMs; var rndTime = new Random().Next(-halfInterval, halfInterval) + AutoReconnectIntervalMs;
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Attempting reconnect in {0} ms, randomized", rndTime); Debug.Console(2, this, "Attempting reconnect in {0} ms, randomized", rndTime);
if (RetryTimer != null) if (RetryTimer != null)
{ {
RetryTimer.Stop(); RetryTimer.Stop();
@@ -503,7 +503,7 @@ namespace PepperDash.Core
else if (SharedKeyRequired && str == "Shared Key Match") else if (SharedKeyRequired && str == "Shared Key Match")
{ {
StopWaitForSharedKeyTimer(); StopWaitForSharedKeyTimer();
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Shared key confirmed. Ready for communication"); Debug.Console(2, this, "Shared key confirmed. Ready for communication");
OnClientReadyForcommunications(true); // Successful key exchange OnClientReadyForcommunications(true); // Successful key exchange
} }
else else
@@ -530,7 +530,7 @@ namespace PepperDash.Core
{ {
if (HeartbeatEnabled) if (HeartbeatEnabled)
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Starting Heartbeat"); Debug.Console(2, this, "Starting Heartbeat");
if (HeartbeatSendTimer == null) if (HeartbeatSendTimer == null)
{ {
@@ -548,13 +548,13 @@ namespace PepperDash.Core
if (HeartbeatSendTimer != null) if (HeartbeatSendTimer != null)
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Stoping Heartbeat Send"); Debug.Console(2, this, "Stoping Heartbeat Send");
HeartbeatSendTimer.Stop(); HeartbeatSendTimer.Stop();
HeartbeatSendTimer = null; HeartbeatSendTimer = null;
} }
if (HeartbeatAckTimer != null) if (HeartbeatAckTimer != null)
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Stoping Heartbeat Ack"); Debug.Console(2, this, "Stoping Heartbeat Ack");
HeartbeatAckTimer.Stop(); HeartbeatAckTimer.Stop();
HeartbeatAckTimer = null; HeartbeatAckTimer = null;
} }
@@ -696,7 +696,7 @@ namespace PepperDash.Core
} }
try try
{ {
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Socket status change: {0} ({1})", client.ClientStatus, (ushort)(client.ClientStatus)); Debug.Console(2, this, "Socket status change: {0} ({1})", client.ClientStatus, (ushort)(client.ClientStatus));
OnConnectionChange(); OnConnectionChange();