From 6c761cf4911acaeeeca2c1f20d0eb8edde5fe4cc Mon Sep 17 00:00:00 2001 From: olegkap_cp Date: Thu, 7 Mar 2013 16:40:29 +0000 Subject: [PATCH] Replace previouse fix with Connection test vs if disposed --- Renci.SshClient/Renci.SshNet/Channels/Channel.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Renci.SshClient/Renci.SshNet/Channels/Channel.cs b/Renci.SshClient/Renci.SshNet/Channels/Channel.cs index 4f2ac587..7b6b97c4 100644 --- a/Renci.SshClient/Renci.SshNet/Channels/Channel.cs +++ b/Renci.SshClient/Renci.SshNet/Channels/Channel.cs @@ -499,8 +499,8 @@ namespace Renci.SshNet.Channels protected virtual void Close(bool wait) { // Send message to close the channel on the server - // Ignore sending close message during dispose object phase - if (!_closeMessageSent && this._isDisposing) + // Ignore sending close message when client not connected + if (!_closeMessageSent && this.IsConnected) { lock (this) { @@ -661,8 +661,6 @@ namespace Renci.SshNet.Channels private bool _isDisposed = false; - private bool _isDisposing = false; - /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// @@ -686,8 +684,6 @@ namespace Renci.SshNet.Channels // and unmanaged resources. if (disposing) { - this._isDisposing = true; - this.Close(false); // Dispose managed resources. @@ -731,9 +727,6 @@ namespace Renci.SshNet.Channels // Note disposing has been done. this._isDisposed = true; - - this._isDisposing = false; - } }