mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-16 05:04:48 +00:00
Changes some debug levels to notify upon errors in console
This commit is contained in:
@@ -217,7 +217,7 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
if (IsConnected)
|
if (IsConnected)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "Connection already connected. Exiting Connect()");
|
Debug.Console(1, this, "Connection already connected. Exiting Connect()");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -272,7 +272,7 @@ namespace PepperDash.Core
|
|||||||
Username, ie.Message);
|
Username, ie.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(1, this, errorLogLevel, "Error on connect:\r({0})", e);
|
Debug.Console(1, this, errorLogLevel, "Error on connect:\r({0})", ie.Message);
|
||||||
|
|
||||||
DisconnectLogged = true;
|
DisconnectLogged = true;
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
||||||
@@ -285,7 +285,7 @@ namespace PepperDash.Core
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
var errorLogLevel = DisconnectLogged == true ? Debug.ErrorLogLevel.None : Debug.ErrorLogLevel.Error;
|
var errorLogLevel = DisconnectLogged == true ? Debug.ErrorLogLevel.None : Debug.ErrorLogLevel.Error;
|
||||||
Debug.Console(1, this, errorLogLevel, "Unhandled exception on connect:\r({0})", e);
|
Debug.Console(1, this, errorLogLevel, "Unhandled exception on connect:\r({0})", e.Message);
|
||||||
DisconnectLogged = true;
|
DisconnectLogged = true;
|
||||||
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
|
||||||
if (AutoReconnect)
|
if (AutoReconnect)
|
||||||
@@ -330,7 +330,7 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "Exception killing client: {0}", ex.Message);
|
Debug.Console(1, this, "Exception killing client: {0}", ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
if (IsConnected)
|
if (IsConnected)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "Connection already connected. Exiting Connect()");
|
Debug.Console(1, this, "Connection already connected. Exiting Connect()");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -319,10 +319,11 @@ namespace PepperDash.Core
|
|||||||
{
|
{
|
||||||
if (IsConnected || DisconnectCalledByUser == true)
|
if (IsConnected || DisconnectCalledByUser == true)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "Reconnect no longer needed. Exiting Reconnect()");
|
Debug.Console(1, this, "Reconnect no longer needed. Exiting Reconnect()");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Debug.Console(1, this, "Attempting reconnect now");
|
||||||
Client.ConnectToServerAsync(ConnectToServerCallback);
|
Client.ConnectToServerAsync(ConnectToServerCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -362,9 +363,15 @@ namespace PepperDash.Core
|
|||||||
/// <param name="c"></param>
|
/// <param name="c"></param>
|
||||||
void ConnectToServerCallback(TCPClient c)
|
void ConnectToServerCallback(TCPClient c)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Server connection result: {0}", c.ClientStatus);
|
if (c.ClientStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
|
||||||
if (c.ClientStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
|
{
|
||||||
WaitAndTryReconnect();
|
Debug.Console(0, this, "Server connection result: {0}", c.ClientStatus);
|
||||||
|
WaitAndTryReconnect();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Server connection result: {0}", c.ClientStatus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -467,14 +474,14 @@ namespace PepperDash.Core
|
|||||||
/// <param name="clientSocketStatus"></param>
|
/// <param name="clientSocketStatus"></param>
|
||||||
void Client_SocketStatusChange(TCPClient client, SocketStatus clientSocketStatus)
|
void Client_SocketStatusChange(TCPClient client, SocketStatus clientSocketStatus)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Socket status change {0} ({1})", clientSocketStatus, ClientStatusText);
|
if (clientSocketStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
|
||||||
if (client.ClientStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
|
|
||||||
WaitAndTryReconnect();
|
|
||||||
|
|
||||||
if(clientSocketStatus == SocketStatus.SOCKET_STATUS_CONNECTED)
|
|
||||||
{
|
{
|
||||||
|
Debug.Console(0, this, "Socket status change {0} ({1})", clientSocketStatus, ClientStatusText);
|
||||||
|
WaitAndTryReconnect();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Socket status change {0} ({1})", clientSocketStatus, ClientStatusText);
|
||||||
Client.ReceiveDataAsync(Receive);
|
Client.ReceiveDataAsync(Receive);
|
||||||
DisconnectCalledByUser = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var handler = ConnectionChange;
|
var handler = ConnectionChange;
|
||||||
|
|||||||
Reference in New Issue
Block a user