Skip to content

Commit

Permalink
* Add _disposed check in AutorecoveringConnection
Browse files Browse the repository at this point in the history
* Cosmetic `ConfigureAwait(false)`
  • Loading branch information
lukebakken committed Jan 13, 2025
1 parent 2d1b15c commit 1cf0540
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 14 additions & 1 deletion projects/RabbitMQ.Client/Impl/AutorecoveringConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,23 @@ await RecordChannelAsync(autorecoveringChannel, channelsSemaphoreHeld: false, ca
return autorecoveringChannel;
}

public void Dispose() => DisposeAsync().AsTask().GetAwaiter().GetResult();
public void Dispose()
{
if (_disposed)
{
return;
}

DisposeAsync().AsTask().GetAwaiter().GetResult();
}

public async ValueTask DisposeAsync()
{
if (_disposed)
{
return;
}

if (IsDisposing)
{
return;
Expand Down
3 changes: 2 additions & 1 deletion projects/RabbitMQ.Client/Impl/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ protected virtual async ValueTask DisposeAsyncCore()
{
if (IsOpen)
{
await this.AbortAsync().ConfigureAwait(false);
await this.AbortAsync()
.ConfigureAwait(false);
}

if (_serverOriginatedChannelCloseTcs is not null)
Expand Down

0 comments on commit 1cf0540

Please sign in to comment.