Skip to content

Commit 47bd34c

Browse files
committed
Dispose method should not throw an exception
1 parent 06dfe7a commit 47bd34c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,25 @@ public void Close(ShutdownEventArgs reason, bool abort)
300300
k.Wait();
301301
ConsumerDispatcher.Shutdown(this);
302302
}
303-
catch (AlreadyClosedException ace)
303+
catch (AlreadyClosedException)
304+
{
305+
if (!abort)
306+
{
307+
throw;
308+
}
309+
}
310+
catch (IOException)
304311
{
305312
if (!abort)
306313
{
307-
throw ace;
314+
throw;
308315
}
309316
}
310-
catch (IOException ioe)
317+
catch (Exception)
311318
{
312319
if (!abort)
313320
{
314-
throw ioe;
321+
throw;
315322
}
316323
}
317324
}
@@ -673,7 +680,7 @@ public void TransmitAndEnqueue(Command cmd, IRpcContinuation k)
673680

674681
void IDisposable.Dispose()
675682
{
676-
Close();
683+
Abort();
677684
}
678685

679686
public abstract void ConnectionTuneOk(ushort channelMax,

0 commit comments

Comments
 (0)