Working through ssh disconnect / leak problems

This commit is contained in:
Heath Volmer
2016-08-04 13:14:32 -06:00
parent cb5d36de51
commit 0f0b61afa2
8 changed files with 117 additions and 58 deletions

View File

@@ -11,7 +11,7 @@ using Newtonsoft.Json.Linq;
namespace PepperDash.Core
{
public class GenericTcpIpClient : Device, IBasicCommunication
public class GenericTcpIpClient : Device, IBasicCommunication, IAutoReconnect
{
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
@@ -21,6 +21,9 @@ namespace PepperDash.Core
public string Status { get { return Client.ClientStatus.ToString(); } }
public string ConnectionFailure { get { return Client.ClientStatus.ToString(); } }
public bool AutoReconnect { get; set; }
public int AutoReconnectIntervalMs { get; set; }
public bool Connected
{
get { return Client.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED; }
@@ -173,9 +176,21 @@ namespace PepperDash.Core
/// </summary>
public int BufferSize { get; set; }
/// <summary>
/// Defaults to true
/// </summary>
public bool AutoReconnect { get; set; }
/// <summary>
/// Defaults to 5000ms
/// </summary>
public int AutoReconnectIntervalMs { get; set; }
public TcpIpConfig()
{
BufferSize = 32768;
AutoReconnect = true;
AutoReconnectIntervalMs = 5000;
}
}