mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-11 10:44:49 +00:00
Trying and failing lots of things to fix SshClient. About to try making and destroying the entire client
This commit is contained in:
@@ -222,7 +222,7 @@ namespace PepperDash.Core
|
||||
if (TheStream != null)
|
||||
{
|
||||
TheStream.DataReceived -= Stream_DataReceived;
|
||||
TheStream.ErrorOccurred += TheStream_ErrorOccurred;
|
||||
TheStream.ErrorOccurred -= TheStream_ErrorOccurred;
|
||||
}
|
||||
TheStream = null;
|
||||
}
|
||||
@@ -242,10 +242,15 @@ namespace PepperDash.Core
|
||||
try
|
||||
{
|
||||
Client.Connect();
|
||||
if (Client.IsConnected)
|
||||
{
|
||||
Client.KeepAliveInterval = TimeSpan.FromSeconds(2);
|
||||
Client.SendKeepAlive();
|
||||
#warning We are getting past here with a false IsConnected when it appears to be connected
|
||||
|
||||
|
||||
// Have to assume client is connected cause Client.IsConnected is busted in some cases
|
||||
// All other conditions *should* error out...
|
||||
//if (Client.IsConnected)
|
||||
//{
|
||||
//Client.KeepAliveInterval = TimeSpan.FromSeconds(2);
|
||||
//Client.SendKeepAlive();
|
||||
TheStream = Client.CreateShellStream("PDTShell", 100, 80, 100, 200, 65534);
|
||||
TheStream.DataReceived += Stream_DataReceived;
|
||||
TheStream.ErrorOccurred += TheStream_ErrorOccurred;
|
||||
@@ -255,7 +260,7 @@ namespace PepperDash.Core
|
||||
PreviousPassword = Password;
|
||||
PreviousPort = Port;
|
||||
PreviousUsername = Username;
|
||||
}
|
||||
//}
|
||||
return; // Success will not pass here
|
||||
}
|
||||
catch (SshConnectionException e)
|
||||
@@ -340,7 +345,7 @@ namespace PepperDash.Core
|
||||
if (TheStream != null)
|
||||
{
|
||||
TheStream.DataReceived -= Stream_DataReceived;
|
||||
TheStream.ErrorOccurred += TheStream_ErrorOccurred;
|
||||
TheStream.ErrorOccurred -= TheStream_ErrorOccurred;
|
||||
TheStream.Close();
|
||||
TheStream.Dispose();
|
||||
TheStream = null;
|
||||
@@ -401,7 +406,7 @@ namespace PepperDash.Core
|
||||
/// </summary>
|
||||
void Client_ErrorOccurred(object sender, Crestron.SimplSharp.Ssh.Common.ExceptionEventArgs e)
|
||||
{
|
||||
if (e.Exception is SshConnectionException)
|
||||
if (e.Exception is SshConnectionException || e.Exception is System.Net.Sockets.SocketException)
|
||||
Debug.Console(1, this, "Disconnected by remote");
|
||||
else
|
||||
Debug.Console(1, this, "Unhandled SSH client error: {0}", e.Exception);
|
||||
|
||||
Binary file not shown.
@@ -2,6 +2,6 @@
|
||||
<ControlSystem>
|
||||
<Name>MC3 SSH</Name>
|
||||
<Address>ssh 10.0.0.15</Address>
|
||||
<ProgramSlot />
|
||||
<Storage />
|
||||
<ProgramSlot>Program01</ProgramSlot>
|
||||
<Storage>Internal Flash</Storage>
|
||||
</ControlSystem>
|
||||
Binary file not shown.
@@ -10,8 +10,8 @@
|
||||
<ArchiveName />
|
||||
</RequiredInfo>
|
||||
<OptionalInfo>
|
||||
<CompiledOn>12/6/2016 9:36:24 AM</CompiledOn>
|
||||
<CompilerRev>1.0.0.17290</CompilerRev>
|
||||
<CompiledOn>12/6/2016 2:53:00 PM</CompiledOn>
|
||||
<CompilerRev>1.0.0.26789</CompilerRev>
|
||||
</OptionalInfo>
|
||||
<Plugin>
|
||||
<Version>Crestron.SIMPLSharp, Version=2.0.48.0, Culture=neutral, PublicKeyToken=812d080f93e2de10</Version>
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
MainAssembly=PepperDash_Core.dll:c8ab0c5c399e1cd7b79710c5a208e022
|
||||
MainAssembly=PepperDash_Core.dll:3a5fe881bafa819e1046cf092f48b180
|
||||
MainAssemblyMinFirmwareVersion=1.007.0017
|
||||
MainAssemblyResource=SimplSharpData.dat:315526abf906cded47fb0c7510266a7e
|
||||
ü
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user