Skip to content

Release 2023.0.1 #1284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 102 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
a5bd08d
Assets/logos (#782)
Filini Feb 21, 2021
f072c5f
OPENSSH KeyReader for more keys (#614)
darinkes Apr 18, 2021
583a9ce
Add interface to SftpFile #120 (#812)
wxtsxt Sep 8, 2021
30d79c7
Start MessageListener with ThreadAbstraction.ExecuteThreadLongRunning…
IgorMilavec Nov 28, 2021
7bdfc9e
Add async support to SftpClient and SftpFileStream (#819)
IgorMilavec Dec 14, 2021
cad9433
Add CODEOWNERS file.
drieseng Feb 11, 2022
37fb864
Fix virus false-positive by Defender on Renci.SSHNet.Tests.dll (#867)
zybexXL Feb 14, 2022
4dfc126
Add unit tests for task-based asynchronous API (#906)
IgorMilavec Feb 15, 2022
b30b11a
correct 'Documenation' to 'Documentation' (#838)
maxijabase Feb 15, 2022
bc99ada
Agent auth and Keygen (#794)
darinkes Mar 5, 2022
03c6d60
Use cryptographically secure random number generator.
drieseng May 29, 2022
c728fba
Merge branch 'develop' of https://github.com/sshnet/SSH.NET into develop
drieseng May 29, 2022
bd7c02f
Remove unused import.
drieseng May 29, 2022
34ce2bd
Add IBaseClient for BaseClient and ISftpClient to inherit from (#975)
Owen-Krueger Jul 3, 2022
b9bc475
fix typo (#999)
psh9508 Aug 26, 2022
f3ebc29
Fix Seek Operations in SftpFileStream (#910)
lemonyte Nov 29, 2022
ab2ccc4
Add back copyright to license. (#1060)
drieseng Dec 20, 2022
cf85100
Removing old target frameworks (#1109)
WojciechNagorski May 6, 2023
8c932fb
Remove old features [Part 1] (#1117)
WojciechNagorski May 9, 2023
072ba7e
Remove FEATURE_DIRECTORYINFO_ENUMERATEFILES (#1119)
WojciechNagorski May 22, 2023
3ecbd10
Fix some (lots of) issues reported by analyzers. (#1125)
drieseng May 24, 2023
c04cdbc
Round 2 of analyzer fixes and general cleanup. (#1132)
drieseng May 29, 2023
27976bb
Analyzer fixes round 3. (#1135)
drieseng May 31, 2023
a4dbf77
Replace Array<T>.Empty with Array.Empty<T>() (#1137)
Rob-Hague Jun 6, 2023
4577899
Replace IsNullOrWhiteSpace extension (#1142)
Rob-Hague Jun 12, 2023
a3dbbc5
Use License Expression for NuGet Package
mus65 Jun 25, 2023
69a42d3
Integration tests
WojciechNagorski Jun 29, 2023
6f567ec
Remove todos
WojciechNagorski Jun 29, 2023
3d36f88
Update CODEOWNERS
WojciechNagorski Aug 25, 2023
592c86c
Merge pull request #1146 from mus65/nuget_license
WojciechNagorski Aug 25, 2023
77b27e5
Merge branch 'master' of https://github.com/sshnet/SSH.NET into integ…
WojciechNagorski Aug 26, 2023
82dc77a
Use correct SSH.NET
WojciechNagorski Aug 30, 2023
bfef6aa
Merge branch 'develop' of https://github.com/sshnet/SSH.NET into inte…
WojciechNagorski Aug 30, 2023
1b46264
Merge pull request #1148 from WojciechNagorski/integration-tests-mstests
WojciechNagorski Aug 30, 2023
7cd0487
ListDirectoryAsync return IAsyncEnumerable (#1126)
WojciechNagorski Aug 30, 2023
004b57a
Fix the assembly resolution build warning (#1165)
Rob-Hague Aug 30, 2023
9f1699b
Delete performance/longrunning tests (#1143)
Rob-Hague Sep 6, 2023
9593e87
Move Integration tests (#1173)
WojciechNagorski Sep 12, 2023
60de8a4
Add a benchmarks project (#1151)
Rob-Hague Sep 15, 2023
dcc596a
Use ExceptionDispatchInfo to retain call stack in Session.WaitOnHandl…
IgorMilavec Sep 15, 2023
43329ee
Support SHA256 fingerprints for host key validation (#1098)
DavisNT Sep 17, 2023
8732d3d
Add support for RSA SHA-2 public key algorithms (#1177)
Rob-Hague Sep 23, 2023
18e6673
Improvements after #1177 (#1180)
WojciechNagorski Sep 23, 2023
aade354
Use ExceptionDispatchInfo in more places (#1182)
Rob-Hague Sep 23, 2023
51e0c67
Try to "fix" the flaky test (#1185)
Rob-Hague Sep 25, 2023
fdd1130
Enable DSA tests (#1181)
Rob-Hague Sep 25, 2023
4ba591e
FingerPrints (#1186)
WojciechNagorski Sep 26, 2023
dd2e552
Use OS-agnostic socket error codes to allow tests run on different OS…
dimhotepus Sep 26, 2023
f28c2c2
Fix for channel session semaphore from thread blocking (#1071)
patrick-yates-redgate Sep 28, 2023
cd1151d
Update ISftpClient for #120 (#1193)
WojciechNagorski Sep 29, 2023
5803ada
Implement set last write and access time (#1194)
WojciechNagorski Sep 29, 2023
70f58b7
Add/migrate hmac+cipher integration tests (#1189)
Rob-Hague Sep 29, 2023
1c7166a
Update tests for SetLastAccessTime(Utc) to also verify the time compo…
drieseng Oct 9, 2023
91d1ed2
Enable list directory async for net framework (#1206)
Patrick-3000 Oct 14, 2023
0e9b518
Remove placeholder tests (#1183)
Rob-Hague Oct 14, 2023
f1297de
Move test projects (#1212)
WojciechNagorski Oct 14, 2023
4679609
Delete more dummy tests (#1213)
Rob-Hague Oct 15, 2023
8e23633
Update Nugets 10/2023 (#1214)
WojciechNagorski Oct 16, 2023
066f998
Upgrade .NET SDK from 7.402 to 7.403. (#1222)
drieseng Oct 25, 2023
42ff920
Merge partial classes and complete IForwardedPort interface (#1223)
drieseng Oct 25, 2023
f745b3f
Use <see langword="..."/> for language keywords.
drieseng Oct 29, 2023
508fc87
Fix analyzer errors in Renci.SshNet and Renci.SshNet.TestTools.OpenSS…
drieseng Nov 1, 2023
826222f
Increase test coverage for AesCipher (#1232)
Rob-Hague Nov 5, 2023
6ec6dc1
Remove byte order mark, set eol=lf in key files
Rob-Hague Oct 21, 2023
60ba1dd
Change the passphrase of Key.OPENSSH.ED25519.Encrypted to "12345"
Rob-Hague Oct 21, 2023
9d6f3ef
Normalize the OpenSSH files
Rob-Hague Oct 21, 2023
d36e7f5
Add OpenSSH public key files
Rob-Hague Oct 21, 2023
1fc6360
Remove duplicate GetManifestResourceStream helpers
Rob-Hague Oct 21, 2023
0829fce
Use shared Data folder for client keys in integration tests
Rob-Hague Oct 21, 2023
09ad44a
Remove unused symbols
Rob-Hague Oct 21, 2023
5ffcb94
Merge pull request #1219 from Rob-Hague/testkeys
drieseng Nov 12, 2023
823bc1b
Use CollectionAssert in ListDirectory tests (#1166)
Rob-Hague Nov 13, 2023
2eec748
Improve SFTP performance on medium/high latency connections (#866)
zybexXL Nov 13, 2023
58284d6
Update global.json (#1240)
Rob-Hague Nov 16, 2023
b4c8291
Tweak diagnostics (#1241)
Rob-Hague Nov 16, 2023
5021f6d
Use System.Security.Cryptography in AesCipher (#1235)
Rob-Hague Nov 16, 2023
54d0162
Enable trace logging for Integration tests (#1242)
WojciechNagorski Nov 16, 2023
f9f2b0e
Expose SshIdentificationReceived event (#1195)
scott-xu Nov 16, 2023
daa1acc
Fix avoidable exception when data length is too long (#823)
se006 Nov 19, 2023
18cf71b
Fix build break in Release (#1248)
Rob-Hague Nov 20, 2023
4ce18d3
Use hardware-accelerated AES CryptoServiceProvider (#865)
zybexXL Nov 28, 2023
5921b6e
Disable a few duplicate analyzer rules. (#1254)
drieseng Nov 30, 2023
d3641a0
Test integration tests (#1250)
WojciechNagorski Nov 30, 2023
4c7bd35
Add support for .NET 8.0 (#1255)
scott-xu Dec 1, 2023
a027c76
Fail with a friendlier error message when response has not been set (…
Rob-Hague Dec 2, 2023
9b0262c
Disable some impactful analyzers (#1246)
Rob-Hague Dec 2, 2023
6d9d032
Rebased AsyncResult fix (#1184)
Rob-Hague Dec 4, 2023
4c4883e
Standardizes additional file types in .editorconfig (#1266)
jacobslusser Dec 9, 2023
f45af38
Replace SemaphoreLight with SemaphoreSlim (#1265)
Rob-Hague Dec 9, 2023
04178d8
Always use factories for HmacAlgorithms (#1262)
Rob-Hague Dec 9, 2023
6220beb
Native async (#1267)
WojciechNagorski Dec 9, 2023
f172ac5
Removes MessageAttribute in favor of properties on Message class (#1270)
jacobslusser Dec 10, 2023
f4371ff
Reduces heap allocations for the some byte[] uses (#1272)
jacobslusser Dec 11, 2023
326ce14
Maintain current build solution (#1268)
scott-xu Dec 15, 2023
34b5123
Send the client key exchange init in Connect (#1274)
Rob-Hague Dec 21, 2023
e998d87
Add a few spans on net6.0 or greater (#1138)
Rob-Hague Dec 21, 2023
24838e6
Make keys immutable (#1264)
Rob-Hague Dec 21, 2023
b0d01df
Try to stabilise a few tests (#1278)
Rob-Hague Dec 22, 2023
e7a64dd
Fix hung dispose caused by infinite socket timeout (#1280)
jkillingsworth Dec 28, 2023
2b53e46
Authenticate with ssh-rsa by default (#1283)
Rob-Hague Dec 28, 2023
4c2dcd5
Upgrade packages (#1279)
Rob-Hague Dec 29, 2023
7436a38
Remove code examples (#1210)
WojciechNagorski Dec 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Analyzer fixes round 3. (#1135)
  • Loading branch information
drieseng authored May 31, 2023
commit 27976bb927d3e93dda6adb4738b54d14070c34e1
6 changes: 2 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
<!--
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview1.23165.1" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.52" PrivateAssets="all" />
-->
<!--
<PackageReference Include="Meziantou.Analyzer" Version="2.0.54" PrivateAssets="all" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.55.0.65544" PrivateAssets="all" />
-->
-->
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Text;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Moq;

using Renci.SshNet.Channels;
using Renci.SshNet.Common;
using Renci.SshNet.Sftp;
Expand Down Expand Up @@ -97,33 +100,47 @@ private void SetupMocks()

#region SftpSession.Connect()

_sessionMock.InSequence(sequence).Setup(p => p.CreateChannelSession()).Returns(_channelSessionMock.Object);
_channelSessionMock.InSequence(sequence).Setup(p => p.Open());
_channelSessionMock.InSequence(sequence).Setup(p => p.SendSubsystemRequest("sftp")).Returns(true);
_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
_channelSessionMock.InSequence(sequence).Setup(p => p.SendData(_sftpInitRequestBytes)).Callback(
() =>
{
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes()));
});
_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
_channelSessionMock.InSequence(sequence).Setup(p => p.SendData(_sftpRealPathRequestBytes)).Callback(
() =>
{
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes()));
});
_ = _sessionMock.InSequence(sequence)
.Setup(p => p.CreateChannelSession())
.Returns(_channelSessionMock.Object);
_ = _channelSessionMock.InSequence(sequence)
.Setup(p => p.Open());
_ = _channelSessionMock.InSequence(sequence)
.Setup(p => p.SendSubsystemRequest("sftp"))
.Returns(true);
_ = _channelSessionMock.InSequence(sequence)
.Setup(p => p.IsOpen)
.Returns(true);
_ = _channelSessionMock.InSequence(sequence)
.Setup(p => p.SendData(_sftpInitRequestBytes))
.Callback(() =>
{
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes()));
});
_ = _channelSessionMock.InSequence(sequence)
.Setup(p => p.IsOpen)
.Returns(true);
_ = _channelSessionMock.InSequence(sequence)
.Setup(p => p.SendData(_sftpRealPathRequestBytes))
.Callback(() =>
{
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes()));
});

#endregion SftpSession.Connect()

_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
_channelSessionMock.InSequence(sequence).Setup(p => p.SendData(_sftpStatVfsRequestBytes)).Callback(
() =>
{
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpStatVfsResponse.GetBytes()));
});
_ = _channelSessionMock.InSequence(sequence)
.Setup(p => p.IsOpen)
.Returns(true);
_ = _channelSessionMock.InSequence(sequence)
.Setup(p => p.SendData(_sftpStatVfsRequestBytes))
.Callback(() =>
{
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpStatVfsResponse.GetBytes()));
});
}

protected void Arrange()
Expand Down Expand Up @@ -153,4 +170,4 @@ public void AvailableBlocksInReturnedValueShouldMatchValueInSftpResponse()
Assert.AreEqual(_bAvail, _actual.AvailableBlocks);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Renci.SshNet.Tests.Classes.Sftp
{
internal class SftpStatVfsResponseBuilder
internal sealed class SftpStatVfsResponseBuilder
{
private uint _protocolVersion;
private uint _responseId;
Expand Down Expand Up @@ -141,8 +141,13 @@ public StatVfsResponse Build()
}
}

internal class StatVfsResponse : SftpExtendedReplyResponse
internal sealed class StatVfsResponse : SftpResponse
{
public override SftpMessageTypes SftpMessageType
{
get { return SftpMessageTypes.ExtendedReply; }
}

public SftpFileSytemInformation Information { get; set; }

public StatVfsResponse(uint protocolVersion)
Expand Down
6 changes: 3 additions & 3 deletions src/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@


<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.3" />
<PackageReference Include="Moq" Version="4.18.4" />
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Renci.SshNet/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ dotnet_diagnostic.SYSLIB1045.severity = none
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1202.md
dotnet_diagnostic.SA1202.severity = none

#### Meziantou.Analyzer rules ####

# MA0053: Make class sealed
# https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0053.md
MA0053.public_class_should_be_sealed = false

#### .NET Compiler Platform analysers rules ####

# CA1031: Do not catch general exception types
Expand Down
16 changes: 16 additions & 0 deletions src/Renci.SshNet/Abstractions/CryptoAbstraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@ public static System.Security.Cryptography.RandomNumberGenerator CreateRandomNum

public static System.Security.Cryptography.MD5 CreateMD5()
{
#pragma warning disable CA5351 // Do not use broken cryptographic algorithms
return System.Security.Cryptography.MD5.Create();
#pragma warning restore CA5351 // Do not use broken cryptographic algorithms
}

public static System.Security.Cryptography.SHA1 CreateSHA1()
{
#pragma warning disable CA5350 // Do not use weak cryptographic algorithms
return System.Security.Cryptography.SHA1.Create();
#pragma warning restore CA5350 // Do not use weak cryptographic algorithms
}

public static System.Security.Cryptography.SHA256 CreateSHA256()
Expand All @@ -66,7 +70,9 @@ public static System.Security.Cryptography.SHA512 CreateSHA512()
public static System.Security.Cryptography.RIPEMD160 CreateRIPEMD160()
{
#if FEATURE_HASH_RIPEMD160_CREATE
#pragma warning disable CA5350 // Do not use weak cryptographic algorithms
return System.Security.Cryptography.RIPEMD160.Create();
#pragma warning restore CA5350 // Do not use weak cryptographic algorithms
#else
return new System.Security.Cryptography.RIPEMD160Managed();
#endif
Expand All @@ -80,22 +86,30 @@ public static System.Security.Cryptography.RIPEMD160 CreateRIPEMD160()

public static System.Security.Cryptography.HMACMD5 CreateHMACMD5(byte[] key)
{
#pragma warning disable CA5351 // Do not use broken cryptographic algorithms
return new System.Security.Cryptography.HMACMD5(key);
#pragma warning restore CA5351 // Do not use broken cryptographic algorithms
}

public static HMACMD5 CreateHMACMD5(byte[] key, int hashSize)
{
#pragma warning disable CA5351 // Do not use broken cryptographic algorithms
return new HMACMD5(key, hashSize);
#pragma warning restore CA5351 // Do not use broken cryptographic algorithms
}

public static System.Security.Cryptography.HMACSHA1 CreateHMACSHA1(byte[] key)
{
#pragma warning disable CA5350 // Do not use weak cryptographic algorithms
return new System.Security.Cryptography.HMACSHA1(key);
#pragma warning restore CA5350 // Do not use weak cryptographic algorithms
}

public static HMACSHA1 CreateHMACSHA1(byte[] key, int hashSize)
{
#pragma warning disable CA5350 // Do not use weak cryptographic algorithms
return new HMACSHA1(key, hashSize);
#pragma warning restore CA5350 // Do not use weak cryptographic algorithms
}

public static System.Security.Cryptography.HMACSHA256 CreateHMACSHA256(byte[] key)
Expand Down Expand Up @@ -131,7 +145,9 @@ public static HMACSHA512 CreateHMACSHA512(byte[] key, int hashSize)
#if FEATURE_HMAC_RIPEMD160
public static System.Security.Cryptography.HMACRIPEMD160 CreateHMACRIPEMD160(byte[] key)
{
#pragma warning disable CA5350 // Do not use weak cryptographic algorithms
return new System.Security.Cryptography.HMACRIPEMD160(key);
#pragma warning restore CA5350 // Do not use weak cryptographic algorithms
}
#else
public static global::SshNet.Security.Cryptography.HMACRIPEMD160 CreateHMACRIPEMD160(byte[] key)
Expand Down
9 changes: 7 additions & 2 deletions src/Renci.SshNet/Abstractions/DiagnosticAbstraction.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Diagnostics;
using System.Threading;

namespace Renci.SshNet.Abstractions
{
Expand All @@ -22,7 +21,13 @@ public static bool IsEnabled(TraceEventType traceEventType)
[Conditional("DEBUG")]
public static void Log(string text)
{
Loggging.TraceEvent(TraceEventType.Verbose, Thread.CurrentThread.ManagedThreadId, text);
Loggging.TraceEvent(TraceEventType.Verbose,
#if NET6_0_OR_GREATER
System.Environment.CurrentManagedThreadId,
#else
System.Threading.Thread.CurrentThread.ManagedThreadId,
#endif // NET6_0_OR_GREATER
text);
}
}
}
6 changes: 3 additions & 3 deletions src/Renci.SshNet/Abstractions/SocketAbstraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ public static bool CanWrite(Socket socket)
public static Socket Connect(IPEndPoint remoteEndpoint, TimeSpan connectTimeout)
{
var socket = new Socket(remoteEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp) { NoDelay = true };
ConnectCore(socket, remoteEndpoint, connectTimeout, true);
ConnectCore(socket, remoteEndpoint, connectTimeout, ownsSocket: true);
return socket;
}

public static void Connect(Socket socket, IPEndPoint remoteEndpoint, TimeSpan connectTimeout)
{
ConnectCore(socket, remoteEndpoint, connectTimeout, false);
ConnectCore(socket, remoteEndpoint, connectTimeout, ownsSocket: false);
}

public static async Task ConnectAsync(Socket socket, IPEndPoint remoteEndpoint, CancellationToken cancellationToken)
Expand All @@ -60,7 +60,7 @@ public static async Task ConnectAsync(Socket socket, IPEndPoint remoteEndpoint,
private static void ConnectCore(Socket socket, IPEndPoint remoteEndpoint, TimeSpan connectTimeout, bool ownsSocket)
{
#if FEATURE_SOCKET_EAP
var connectCompleted = new ManualResetEvent(false);
var connectCompleted = new ManualResetEvent(initialState: false);
var args = new SocketAsyncEventArgs
{
UserToken = connectCompleted,
Expand Down
8 changes: 4 additions & 4 deletions src/Renci.SshNet/Abstractions/SocketExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void SetCompleted()
{
IsCompleted = true;

var continuation = _continuationAction ?? Interlocked.CompareExchange(ref _continuationAction, SENTINEL, null);
var continuation = _continuationAction ?? Interlocked.CompareExchange(ref _continuationAction, SENTINEL, comparand: null);
if (continuation is not null)
{
continuation();
Expand All @@ -57,7 +57,7 @@ public SocketAsyncEventArgsAwaitable GetAwaiter()

void INotifyCompletion.OnCompleted(Action continuation)
{
if (_continuationAction == SENTINEL || Interlocked.CompareExchange(ref _continuationAction, continuation, null) == SENTINEL)
if (_continuationAction == SENTINEL || Interlocked.CompareExchange(ref _continuationAction, continuation, comparand: null) == SENTINEL)
{
// We have already completed; run continuation asynchronously
_ = Task.Run(continuation);
Expand Down Expand Up @@ -92,7 +92,7 @@ public static async Task ConnectAsync(this Socket socket, IPEndPoint remoteEndpo
{
args.RemoteEndPoint = remoteEndpoint;

using (cancellationToken.Register(o => ((SocketAsyncEventArgsAwaitable)o).SetCancelled(), args, false))
using (cancellationToken.Register(o => ((SocketAsyncEventArgsAwaitable)o).SetCancelled(), args, useSynchronizationContext: false))
{
await args.ExecuteAsync(socket.ConnectAsync);
}
Expand All @@ -107,7 +107,7 @@ public static async Task<int> ReceiveAsync(this Socket socket, byte[] buffer, in
{
args.SetBuffer(buffer, offset, length);

using (cancellationToken.Register(o => ((SocketAsyncEventArgsAwaitable)o).SetCancelled(), args, false))
using (cancellationToken.Register(o => ((SocketAsyncEventArgsAwaitable)o).SetCancelled(), args, useSynchronizationContext: false))
{
await args.ExecuteAsync(socket.ReceiveAsync);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Renci.SshNet/BaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ protected BaseClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo)
/// If <paramref name="ownsConnectionInfo"/> is <c>true</c>, then the
/// connection info will be disposed when this instance is disposed.
/// </remarks>
internal BaseClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
private protected BaseClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
{
if (connectionInfo is null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Renci.SshNet/Channels/ChannelDirectTcpip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Renci.SshNet.Channels
/// <summary>
/// Implements "direct-tcpip" SSH channel.
/// </summary>
internal class ChannelDirectTcpip : ClientChannel, IChannelDirectTcpip
internal sealed class ChannelDirectTcpip : ClientChannel, IChannelDirectTcpip
{
private readonly object _socketLock = new object();

Expand Down
2 changes: 1 addition & 1 deletion src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Renci.SshNet.Channels
/// <summary>
/// Implements "forwarded-tcpip" SSH channel.
/// </summary>
internal class ChannelForwardedTcpip : ServerChannel, IChannelForwardedTcpip
internal sealed class ChannelForwardedTcpip : ServerChannel, IChannelForwardedTcpip
{
private readonly object _socketShutdownAndCloseLock = new object();
private Socket _socket;
Expand Down
4 changes: 2 additions & 2 deletions src/Renci.SshNet/ClientAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Renci.SshNet
{
internal class ClientAuthentication : IClientAuthentication
internal sealed class ClientAuthentication : IClientAuthentication
{
private readonly int _partialSuccessLimit;

Expand Down Expand Up @@ -151,7 +151,7 @@ private bool TryAuthenticate(ISession session,
return false;
}

private class AuthenticationState
private sealed class AuthenticationState
{
private readonly IList<IAuthenticationMethod> _supportedAuthenticationMethods;

Expand Down
Loading