From f28c2c2dd03c95230fd1b16b3460ec4dbc5131fa Mon Sep 17 00:00:00 2001 From: Patrick Yates <114094360+patrick-yates-redgate@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:01:18 +0100 Subject: [PATCH] Fix for channel session semaphore from thread blocking (#1071) * 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 * 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 * Update Channel to fix AppVeyor failure (field should be readonly) --- src/Renci.SshNet/Channels/Channel.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Renci.SshNet/Channels/Channel.cs b/src/Renci.SshNet/Channels/Channel.cs index df76e67c..d3ec7ca6 100644 --- a/src/Renci.SshNet/Channels/Channel.cs +++ b/src/Renci.SshNet/Channels/Channel.cs @@ -22,7 +22,7 @@ namespace Renci.SshNet.Channels private uint? _remoteWindowSize; private uint? _remoteChannelNumber; private uint? _remotePacketSize; - private ISession _session; + private readonly ISession _session; private bool _isDisposed; /// @@ -834,7 +834,6 @@ namespace Renci.SshNet.Channels var session = _session; if (session != null) { - _session = null; session.ChannelWindowAdjustReceived -= OnChannelWindowAdjust; session.ChannelDataReceived -= OnChannelData; session.ChannelExtendedDataReceived -= OnChannelExtendedData;