Commit 5892858 1 parent 64bce8b commit 5892858 Copy full SHA for 5892858
File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -249,9 +249,13 @@ class PhoenixSocket {
249
249
_topicMessages.close ();
250
250
_topicStreams.clear ();
251
251
252
+ _connectionManager? .dispose (normalClosure);
253
+ _connectionManager = null ;
254
+
252
255
_socketStateStream.close ();
253
256
_stateEventStreamController.close ();
254
257
_receiveStreamController.close ();
258
+
255
259
_logger.info ('Disposed of PhoenixSocket' );
256
260
}
257
261
@@ -275,6 +279,7 @@ class PhoenixSocket {
275
279
Future <void > _closeConnection (int code, {String ? reason}) async {
276
280
if (_disposed) {
277
281
_logger.warning ('Cannot close a disposed socket' );
282
+ return ;
278
283
}
279
284
if (_connectionManager != null ) {
280
285
_connectionManager! .dispose (code, reason);
@@ -582,6 +587,10 @@ class PhoenixSocket {
582
587
() =>
583
588
'Socket closed with code ${closeEvent .code } and reason "${closeEvent .reason }"' ,
584
589
);
585
- _triggerChannelExceptions (exception);
590
+
591
+ if (_connectionManager != null ) {
592
+ // Otherwise we have closed the connections ourselves.
593
+ _triggerChannelExceptions (exception);
594
+ }
586
595
}
587
596
}
You can’t perform that action at this time.
0 commit comments