|
|
@@ -309,6 +309,10 @@ namespace Renci.SshNet
|
|
|
|
|
|
private void Session_Disconnected(object sender, EventArgs e)
|
|
|
{
|
|
|
+ // If objected is disposed or being disposed don't handle this event
|
|
|
+ if (this._isDisposed)
|
|
|
+ return;
|
|
|
+
|
|
|
this._exception = new SshConnectionException("An established connection was aborted by the software in your host machine.", DisconnectReason.ConnectionLost);
|
|
|
|
|
|
this._sessionErrorOccuredWaitHandle.Set();
|
|
|
@@ -316,6 +320,10 @@ namespace Renci.SshNet
|
|
|
|
|
|
private void Session_ErrorOccured(object sender, ExceptionEventArgs e)
|
|
|
{
|
|
|
+ // If objected is disposed or being disposed don't handle this event
|
|
|
+ if (this._isDisposed)
|
|
|
+ return;
|
|
|
+
|
|
|
this._exception = e.Exception;
|
|
|
|
|
|
this._sessionErrorOccuredWaitHandle.Set();
|