File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -581,23 +581,27 @@ class PgConnectionImplementation extends _PgSessionBase implements Connection {
581
581
_socketIsBroken = _socketIsBroken || socketIsBroken;
582
582
if (! _isClosing) {
583
583
_isClosing = true ;
584
-
585
- if (interruptRunning) {
586
- _pending? .handleConnectionClosed (cause);
587
- if (! _socketIsBroken) {
588
- _channel.sink.add (const TerminateMessage ());
589
- }
590
- } else {
591
- // Wait for the previous operation to complete by using the lock
592
- await _operationLock.withResource (() {
584
+ try {
585
+ if (interruptRunning) {
586
+ _pending? .handleConnectionClosed (cause);
593
587
if (! _socketIsBroken) {
594
588
_channel.sink.add (const TerminateMessage ());
595
589
}
596
- });
597
- }
590
+ } else {
591
+ // Wait for the previous operation to complete by using the lock
592
+ await _operationLock.withResource (() {
593
+ if (! _socketIsBroken) {
594
+ _channel.sink.add (const TerminateMessage ());
595
+ }
596
+ });
597
+ }
598
598
599
- await Future .wait ([_channel.sink.close (), _serverMessages.cancel ()]);
600
- _closeSession ();
599
+ await Future .wait ([_channel.sink.close (), _serverMessages.cancel ()]);
600
+ _closeSession ();
601
+ } catch (err) {
602
+ // error in _close(), silencing since the connection is no longer
603
+ // usable anyway
604
+ }
601
605
}
602
606
}
603
607
You can’t perform that action at this time.
0 commit comments