Skip to content

Commit ad53338

Browse files
committed
Merge branch 'lukebakken/fix-closereason' into stringallocations
2 parents 397526f + f445f2d commit ad53338

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

projects/RabbitMQ.Client/client/impl/AutorecoveringChannel.cs

+12-3
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,21 @@ await _connection.RecoverConsumersAsync(this, newChannel, recordedEntitiesSemaph
200200
_innerChannel.RunRecoveryEventHandlers(this);
201201
}
202202

203-
public Task CloseAsync(ushort replyCode, string replyText, bool abort,
203+
public async Task CloseAsync(ushort replyCode, string replyText, bool abort,
204204
CancellationToken cancellationToken)
205205
{
206206
ThrowIfDisposed();
207-
var args = new ShutdownEventArgs(ShutdownInitiator.Library, replyCode, replyText);
208-
return CloseAsync(args, abort, cancellationToken);
207+
try
208+
{
209+
await _innerChannel.CloseAsync(replyCode, replyText, abort, cancellationToken)
210+
.ConfigureAwait(false);
211+
}
212+
finally
213+
{
214+
await _connection.DeleteRecordedChannelAsync(this,
215+
channelsSemaphoreHeld: false, recordedEntitiesSemaphoreHeld: false)
216+
.ConfigureAwait(false);
217+
}
209218
}
210219

211220
public async Task CloseAsync(ShutdownEventArgs args, bool abort,

projects/Test/Applications/MassPublish/Program.cs

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ await publishChannel.BasicPublishAsync(exchange: ExchangeName, routingKey: Routi
156156
}
157157

158158
await consumeChannel.CloseAsync();
159+
await consumeConnection.CloseAsync();
159160
}
160161

161162
private static void PublishChannel_BasicNacks(object sender, BasicNackEventArgs e)

0 commit comments

Comments
 (0)