mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-10-17 05:21:15 +08:00
Fix SocketAsyncEventArgsAwaitable calling continuation multiple times (#918)
* Fix SocketAsyncEventArgsAwaitable calling continuation multiple times * Use Interlocked.Exchange --------- Co-authored-by: Rob Hague <rob.hague00@gmail.com>
This commit is contained in:
@@ -33,11 +33,10 @@ namespace Renci.SshNet.Abstractions
|
||||
return this;
|
||||
}
|
||||
|
||||
public void SetCompleted()
|
||||
private void SetCompleted()
|
||||
{
|
||||
IsCompleted = true;
|
||||
|
||||
var continuation = _continuationAction ?? Interlocked.CompareExchange(ref _continuationAction, SENTINEL, comparand: null);
|
||||
var continuation = Interlocked.Exchange(ref _continuationAction, SENTINEL);
|
||||
if (continuation is not null)
|
||||
{
|
||||
continuation();
|
||||
|
||||
Reference in New Issue
Block a user