Skip to content

Commit e9f0c68

Browse files
committed
CSHARP-5743: version 3.5 causes delays and disruptions because it is trying to access a disposed semaphore slim
1 parent 77d5ed7 commit e9f0c68

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/MongoDB.Driver/Core/Connections/BinaryConnection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ public async Task<ResponseMessage> ReceiveMessageAsync(OperationContext operatio
543543

544544
private void SendBuffer(OperationContext operationContext, IByteBuffer buffer)
545545
{
546+
ThrowIfCancelledOrDisposed(operationContext);
546547
_sendLock.Wait(operationContext.RemainingTimeout, operationContext.CancellationToken);
547548
try
548549
{
@@ -571,6 +572,7 @@ private void SendBuffer(OperationContext operationContext, IByteBuffer buffer)
571572

572573
private async Task SendBufferAsync(OperationContext operationContext, IByteBuffer buffer)
573574
{
575+
ThrowIfCancelledOrDisposed(operationContext);
574576
await _sendLock.WaitAsync(operationContext.RemainingTimeout, operationContext.CancellationToken).ConfigureAwait(false);
575577
try
576578
{

0 commit comments

Comments
 (0)