Skip to content

Commit 1cf0540

Browse files
committed
* Add _disposed check in AutorecoveringConnection
* Cosmetic `ConfigureAwait(false)`
1 parent 2d1b15c commit 1cf0540

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

projects/RabbitMQ.Client/Impl/AutorecoveringConnection.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,23 @@ await RecordChannelAsync(autorecoveringChannel, channelsSemaphoreHeld: false, ca
270270
return autorecoveringChannel;
271271
}
272272

273-
public void Dispose() => DisposeAsync().AsTask().GetAwaiter().GetResult();
273+
public void Dispose()
274+
{
275+
if (_disposed)
276+
{
277+
return;
278+
}
279+
280+
DisposeAsync().AsTask().GetAwaiter().GetResult();
281+
}
274282

275283
public async ValueTask DisposeAsync()
276284
{
285+
if (_disposed)
286+
{
287+
return;
288+
}
289+
277290
if (IsDisposing)
278291
{
279292
return;

projects/RabbitMQ.Client/Impl/Channel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,8 @@ protected virtual async ValueTask DisposeAsyncCore()
591591
{
592592
if (IsOpen)
593593
{
594-
await this.AbortAsync().ConfigureAwait(false);
594+
await this.AbortAsync()
595+
.ConfigureAwait(false);
595596
}
596597

597598
if (_serverOriginatedChannelCloseTcs is not null)

0 commit comments

Comments
 (0)