Skip to content

Commit f27607b

Browse files
Dispose heartbeat timers on connection termination
1 parent 7bb4ce0 commit f27607b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,11 +988,18 @@ public void StartMainLoop(bool useBackgroundThread)
988988
mainLoopThread.Start();
989989
}
990990

991+
protected void StopHeartbeatTimers()
992+
{
993+
_heartbeatReadTimer.Dispose();
994+
_heartbeatWriteTimer.Dispose();
995+
}
996+
991997
///<remarks>
992998
/// May be called more than once. Should therefore be idempotent.
993999
///</remarks>
9941000
public void TerminateMainloop()
9951001
{
1002+
StopHeartbeatTimers();
9961003
m_running = false;
9971004
}
9981005

@@ -1077,6 +1084,7 @@ public void HandleConnectionUnblocked()
10771084

10781085
void IDisposable.Dispose()
10791086
{
1087+
StopHeartbeatTimers();
10801088
Abort();
10811089
if (ShutdownReport.Count > 0)
10821090
{

0 commit comments

Comments
 (0)