File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
projects/client/RabbitMQ.Client/src/client/impl Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -985,15 +985,22 @@ public void HeartbeatWriteTimerCallback(object state)
985
985
986
986
protected void MaybeStopHeartbeatTimers ( )
987
987
{
988
- if ( _heartbeatReadTimer != null )
989
- {
990
- _heartbeatReadTimer . Change ( Timeout . Infinite , Timeout . Infinite ) ;
991
- _heartbeatReadTimer . Dispose ( ) ;
992
- }
993
- if ( _heartbeatWriteTimer != null )
988
+ MaybeDisposeTimer ( _heartbeatReadTimer ) ;
989
+ MaybeDisposeTimer ( _heartbeatWriteTimer ) ;
990
+ }
991
+
992
+ private void MaybeDisposeTimer ( Timer timer )
993
+ {
994
+ if ( timer != null )
994
995
{
995
- _heartbeatWriteTimer . Change ( Timeout . Infinite , Timeout . Infinite ) ;
996
- _heartbeatWriteTimer . Dispose ( ) ;
996
+ try
997
+ {
998
+ timer . Change ( Timeout . Infinite , Timeout . Infinite ) ;
999
+ timer . Dispose ( ) ;
1000
+ } catch ( ObjectDisposedException ignored )
1001
+ {
1002
+ // we are shutting down, ignore
1003
+ }
997
1004
}
998
1005
}
999
1006
You can’t perform that action at this time.
0 commit comments