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 @@ -1092,15 +1092,22 @@ public void HeartbeatWriteTimerCallback(object state)
1092
1092
1093
1093
protected void MaybeStopHeartbeatTimers ( )
1094
1094
{
1095
- if ( _heartbeatReadTimer != null )
1096
- {
1097
- _heartbeatReadTimer . Change ( Timeout . Infinite , Timeout . Infinite ) ;
1098
- _heartbeatReadTimer . Dispose ( ) ;
1099
- }
1100
- if ( _heartbeatWriteTimer != null )
1095
+ MaybeDisposeTimer ( _heartbeatReadTimer ) ;
1096
+ MaybeDisposeTimer ( _heartbeatWriteTimer ) ;
1097
+ }
1098
+
1099
+ private void MaybeDisposeTimer ( Timer timer )
1100
+ {
1101
+ if ( timer != null )
1101
1102
{
1102
- _heartbeatWriteTimer . Change ( Timeout . Infinite , Timeout . Infinite ) ;
1103
- _heartbeatWriteTimer . Dispose ( ) ;
1103
+ try
1104
+ {
1105
+ timer . Change ( Timeout . Infinite , Timeout . Infinite ) ;
1106
+ timer . Dispose ( ) ;
1107
+ } catch ( ObjectDisposedException ignored )
1108
+ {
1109
+ // we are shutting down, ignore
1110
+ }
1104
1111
}
1105
1112
}
1106
1113
You can’t perform that action at this time.
0 commit comments