Skip to content

Commit 2ba3900

Browse files
author
Steve Powell
committed
Catch AlreadyClosedException in Connection.Close() for overlapping closes.
1 parent 542e4f9 commit 2ba3900

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

projects/client/RabbitMQ.Client/src/client/impl/ConnectionBase.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,18 @@ public void Close(ShutdownEventArgs reason, bool abort, int timeout)
449449
m_session0.Transmit(ConnectionCloseWrapper(reason.ReplyCode,
450450
reason.ReplyText));
451451
}
452-
catch (IOException ioe) {
452+
catch (AlreadyClosedException ace)
453+
{
454+
if (abort) {
455+
if (!m_appContinuation.WaitOne(BlockingCell.validatedTimeout(timeout), true))
456+
m_frameHandler.Close();
457+
return;
458+
} else {
459+
throw ace;
460+
}
461+
}
462+
catch (IOException ioe)
463+
{
453464
if (m_model0.CloseReason == null)
454465
{
455466
if (!abort)

0 commit comments

Comments
 (0)