From 106ff5075e34ad09dc5aa71963c0d0e0aff188bf Mon Sep 17 00:00:00 2001 From: patrick-yates-redgate Date: Wed, 18 Jan 2023 13:27:14 +0000 Subject: [PATCH 1/3] Merging fix from @clivetong into our own SSH.NET fork - The following article describes some of the issues with the double check lock that we have seen issues with: https://www.sudhanshutheone.com/posts/double-check-lock-csharp --- src/Renci.SshNet/Channels/Channel.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Renci.SshNet/Channels/Channel.cs b/src/Renci.SshNet/Channels/Channel.cs index a6311a981..27b311e8f 100644 --- a/src/Renci.SshNet/Channels/Channel.cs +++ b/src/Renci.SshNet/Channels/Channel.cs @@ -844,7 +844,6 @@ protected virtual void Dispose(bool disposing) var session = _session; if (session != null) { - _session = null; session.ChannelWindowAdjustReceived -= OnChannelWindowAdjust; session.ChannelDataReceived -= OnChannelData; session.ChannelExtendedDataReceived -= OnChannelExtendedData; From a5300908b93bcbb0a7f696de220f20fc941daadc Mon Sep 17 00:00:00 2001 From: patrick-yates-redgate Date: Wed, 18 Jan 2023 13:27:14 +0000 Subject: [PATCH 2/3] Merging fix from @clivetong into our own SSH.NET fork - The following article describes some of the issues with the double check lock that we have seen issues with: https://www.sudhanshutheone.com/posts/double-check-lock-csharp --- src/Renci.SshNet/Channels/Channel.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Renci.SshNet/Channels/Channel.cs b/src/Renci.SshNet/Channels/Channel.cs index df76e67cc..ddd38240b 100644 --- a/src/Renci.SshNet/Channels/Channel.cs +++ b/src/Renci.SshNet/Channels/Channel.cs @@ -834,7 +834,6 @@ protected virtual void Dispose(bool disposing) var session = _session; if (session != null) { - _session = null; session.ChannelWindowAdjustReceived -= OnChannelWindowAdjust; session.ChannelDataReceived -= OnChannelData; session.ChannelExtendedDataReceived -= OnChannelExtendedData; From b0a6ad6becc9f9062ebd9bc8f817da704c9732ee Mon Sep 17 00:00:00 2001 From: Patrick Yates Date: Thu, 28 Sep 2023 11:01:46 +0100 Subject: [PATCH 3/3] Update Channel to fix AppVeyor failure (field should be readonly) --- src/Renci.SshNet/Channels/Channel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Renci.SshNet/Channels/Channel.cs b/src/Renci.SshNet/Channels/Channel.cs index ddd38240b..d3ec7ca6c 100644 --- a/src/Renci.SshNet/Channels/Channel.cs +++ b/src/Renci.SshNet/Channels/Channel.cs @@ -22,7 +22,7 @@ internal abstract class Channel : IChannel private uint? _remoteWindowSize; private uint? _remoteChannelNumber; private uint? _remotePacketSize; - private ISession _session; + private readonly ISession _session; private bool _isDisposed; ///