Skip to content

Commit 378121a

Browse files
committed
Make sure corresponding Connection and Channel token properly float into handlers
1 parent 58ac949 commit 378121a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

projects/RabbitMQ.Client/Impl/Channel.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ protected void TakeOver(Channel other)
196196
public Task CloseAsync(ushort replyCode, string replyText, bool abort,
197197
CancellationToken cancellationToken)
198198
{
199-
var args = new ShutdownEventArgs(ShutdownInitiator.Application, replyCode, replyText);
199+
var args = new ShutdownEventArgs(ShutdownInitiator.Application, replyCode, replyText, cancellationToken: cancellationToken);
200200
return CloseAsync(args, abort, cancellationToken);
201201
}
202202

@@ -763,7 +763,7 @@ protected async Task<bool> HandleConnectionStartAsync(IncomingCommand cmd, Cance
763763
{
764764
if (m_connectionStartCell is null)
765765
{
766-
var reason = new ShutdownEventArgs(ShutdownInitiator.Library, Constants.CommandInvalid, "Unexpected Connection.Start");
766+
var reason = new ShutdownEventArgs(ShutdownInitiator.Library, Constants.CommandInvalid, "Unexpected Connection.Start", cancellationToken: cancellationToken);
767767
await Session.Connection.CloseAsync(reason, false,
768768
InternalConstants.DefaultConnectionCloseTimeout,
769769
cancellationToken)

projects/RabbitMQ.Client/Impl/Connection.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ await _channel0.ConnectionOpenAsync(_config.VirtualHost, cancellationToken)
252252
{
253253
try
254254
{
255-
var ea = new ShutdownEventArgs(ShutdownInitiator.Library, Constants.InternalError, "FailedOpen");
255+
var ea = new ShutdownEventArgs(ShutdownInitiator.Library, Constants.InternalError, "FailedOpen", cancellationToken: cancellationToken);
256256
await CloseAsync(ea, true,
257257
InternalConstants.DefaultConnectionAbortTimeout,
258258
cancellationToken).ConfigureAwait(false);
@@ -297,7 +297,7 @@ internal void EnsureIsOpen()
297297
public Task CloseAsync(ushort reasonCode, string reasonText, TimeSpan timeout, bool abort,
298298
CancellationToken cancellationToken = default)
299299
{
300-
var reason = new ShutdownEventArgs(ShutdownInitiator.Application, reasonCode, reasonText);
300+
var reason = new ShutdownEventArgs(ShutdownInitiator.Application, reasonCode, reasonText, cancellationToken: cancellationToken);
301301
return CloseAsync(reason, abort, timeout, cancellationToken);
302302
}
303303

0 commit comments

Comments
 (0)