Skip to content

Commit d379d64

Browse files
committed
* Additional _disposed checks in Connection.
1 parent d06c7cf commit d379d64

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

projects/RabbitMQ.Client/Impl/Connection.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,23 @@ internal ValueTask WriteAsync(RentedMemory frames, CancellationToken cancellatio
487487
return _frameHandler.WriteAsync(frames, cancellationToken);
488488
}
489489

490-
public void Dispose() => DisposeAsync().AsTask().GetAwaiter().GetResult();
490+
public void Dispose()
491+
{
492+
if (_disposed)
493+
{
494+
return;
495+
}
496+
497+
DisposeAsync().AsTask().GetAwaiter().GetResult();
498+
}
491499

492500
public async ValueTask DisposeAsync()
493501
{
502+
if (_disposed)
503+
{
504+
return;
505+
}
506+
494507
if (IsDisposing)
495508
{
496509
return;

0 commit comments

Comments
 (0)