ecs-732; Fixed reconnect on initial connection; changed debug levels to 1

This commit is contained in:
Heath Volmer
2018-06-05 10:25:27 -06:00
parent 88a35b0e40
commit e829ba74d5
5 changed files with 7 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -217,7 +217,7 @@ namespace PepperDash.Core
//{ //{
if (Client != null) if (Client != null)
{ {
Debug.Console(2, this, "Cleaning up disconnected client"); Debug.Console(1, this, "Cleaning up disconnected client");
Client.ErrorOccurred -= Client_ErrorOccurred; Client.ErrorOccurred -= Client_ErrorOccurred;
KillStream(); KillStream();
@@ -229,7 +229,7 @@ namespace PepperDash.Core
//TheStream = null; //TheStream = null;
} }
Debug.Console(2, this, "Creating new SshClient"); Debug.Console(1, this, "Creating new SshClient");
ConnectionInfo connectionInfo = new ConnectionInfo(Hostname, Port, Username, pauth, kauth); ConnectionInfo connectionInfo = new ConnectionInfo(Hostname, Port, Username, pauth, kauth);
Client = new SshClient(connectionInfo); Client = new SshClient(connectionInfo);
Client.ErrorOccurred += Client_ErrorOccurred; Client.ErrorOccurred += Client_ErrorOccurred;

View File

@@ -234,9 +234,8 @@ namespace PepperDash.Core
Client = new TCPClient(Hostname, Port, BufferSize); Client = new TCPClient(Hostname, Port, BufferSize);
Client.SocketStatusChange += Client_SocketStatusChange; Client.SocketStatusChange += Client_SocketStatusChange;
} }
Client.ConnectToServerAsync(null);
DisconnectCalledByUser = false; DisconnectCalledByUser = false;
Client.ConnectToServerAsync(ConnectToServerCallback); // (null);
} }
public void Disconnect() public void Disconnect()
@@ -258,6 +257,7 @@ namespace PepperDash.Core
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(); WaitAndTryReconnect();
} }
@@ -266,7 +266,7 @@ namespace PepperDash.Core
{ {
DisconnectClient(); DisconnectClient();
Debug.Console(2, "Attempting reconnect, status={0}", Client.ClientStatus); Debug.Console(1, "Attempting reconnect, status={0}", Client.ClientStatus);
if(!DisconnectCalledByUser) if(!DisconnectCalledByUser)
RetryTimer = new CTimer(o => { Client.ConnectToServerAsync(ConnectToServerCallback); }, AutoReconnectIntervalMs); RetryTimer = new CTimer(o => { Client.ConnectToServerAsync(ConnectToServerCallback); }, AutoReconnectIntervalMs);
} }
@@ -326,7 +326,7 @@ namespace PepperDash.Core
void Client_SocketStatusChange(TCPClient client, SocketStatus clientSocketStatus) void Client_SocketStatusChange(TCPClient client, SocketStatus clientSocketStatus)
{ {
Debug.Console(2, this, "Socket status change {0} ({1})", clientSocketStatus, ClientStatusText); Debug.Console(1, this, "Socket status change {0} ({1})", clientSocketStatus, ClientStatusText);
if (client.ClientStatus != SocketStatus.SOCKET_STATUS_CONNECTED && !DisconnectCalledByUser && AutoReconnect) if (client.ClientStatus != SocketStatus.SOCKET_STATUS_CONNECTED && !DisconnectCalledByUser && AutoReconnect)
WaitAndTryReconnect(); WaitAndTryReconnect();

View File

@@ -4,4 +4,4 @@
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pepperdash_Core")] [assembly: AssemblyProduct("Pepperdash_Core")]
[assembly: AssemblyCopyright("Copyright © PepperDash 2016")] [assembly: AssemblyCopyright("Copyright © PepperDash 2016")]
[assembly: AssemblyVersion("1.0.6.*")] [assembly: AssemblyVersion("1.0.7.*")]