File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
RabbitMQ.AMQP.Client/Impl Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public class AmqpConnection : AbstractLifeCycle, IConnection
25
25
26
26
// The native AMQP.Net Lite connection
27
27
private Connection ? _nativeConnection ;
28
+ private ClosedCallback ? _closedCallback ;
28
29
29
30
private readonly AmqpManagement _management ;
30
31
private readonly RecordingTopologyListener _recordingTopologyListener = new ( ) ;
@@ -149,6 +150,10 @@ protected override void Dispose(bool disposing)
149
150
if ( disposing )
150
151
{
151
152
// TODO probably more should/could happen in this method
153
+ if ( _nativeConnection is not null )
154
+ {
155
+ _nativeConnection . Closed -= _closedCallback ;
156
+ }
152
157
_semaphoreOpen . Dispose ( ) ;
153
158
_semaphoreClose . Dispose ( ) ;
154
159
}
@@ -271,8 +276,8 @@ void OnOpened(Amqp.IConnection connection, Open open1)
271
276
await _management . OpenAsync ( )
272
277
. ConfigureAwait ( false ) ;
273
278
274
- ClosedCallback closedCallback = BuildClosedCallback ( ) ;
275
- _nativeConnection . AddClosedCallback ( closedCallback ) ;
279
+ _closedCallback = BuildClosedCallback ( ) ;
280
+ _nativeConnection . AddClosedCallback ( _closedCallback ) ;
276
281
}
277
282
catch ( AmqpException e )
278
283
{
You can’t perform that action at this time.
0 commit comments