@@ -52,7 +52,7 @@ internal class BinaryConnection : IConnection
52
52
private DateTime _openedAtUtc ;
53
53
private readonly object _openLock = new object ( ) ;
54
54
private Task _openTask ;
55
- private readonly AsyncLock _receiveLock ;
55
+ private readonly SemaphoreSlim _receiveLock ;
56
56
private readonly SemaphoreSlim _sendLock ;
57
57
private readonly ConnectionSettings _settings ;
58
58
private readonly InterlockedInt32 _state ;
@@ -86,7 +86,7 @@ public BinaryConnection(ServerId serverId, EndPoint endPoint, ConnectionSettings
86
86
_backgroundTaskCancellationToken = _backgroundTaskCancellationTokenSource . Token ;
87
87
88
88
_connectionId = new ConnectionId ( serverId ) ;
89
- _receiveLock = new AsyncLock ( ) ;
89
+ _receiveLock = new SemaphoreSlim ( 1 ) ;
90
90
_sendLock = new SemaphoreSlim ( 1 ) ;
91
91
_state = new InterlockedInt32 ( State . Initial ) ;
92
92
@@ -321,7 +321,7 @@ private IByteBuffer ReceiveBuffer()
321
321
322
322
private IByteBuffer ReceiveBuffer ( int responseTo , CancellationToken cancellationToken )
323
323
{
324
- using ( var receiveLockRequest = _receiveLock . Request ( cancellationToken ) )
324
+ using ( var receiveLockRequest = new SemaphoreSlimRequest ( _receiveLock , cancellationToken ) )
325
325
{
326
326
var messageTask = _dropbox . GetMessageAsync ( responseTo ) ;
327
327
try
@@ -382,7 +382,7 @@ private async Task<IByteBuffer> ReceiveBufferAsync()
382
382
383
383
private async Task < IByteBuffer > ReceiveBufferAsync ( int responseTo , CancellationToken cancellationToken )
384
384
{
385
- using ( var receiveLockRequest = _receiveLock . Request ( cancellationToken ) )
385
+ using ( var receiveLockRequest = new SemaphoreSlimRequest ( _receiveLock , cancellationToken ) )
386
386
{
387
387
var messageTask = _dropbox . GetMessageAsync ( responseTo ) ;
388
388
try
0 commit comments