File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,7 @@ class NodeChannel {
266
266
this . _open = true ;
267
267
this . _error = null ;
268
268
this . _handleConnectionError = this . _handleConnectionError . bind ( this ) ;
269
+ this . _handleConnectionTerminated = this . _handleConnectionTerminated . bind ( this ) ;
269
270
270
271
this . _encrypted = opts . encrypted ;
271
272
this . _conn = connect ( opts , ( ) => {
@@ -299,10 +300,8 @@ class NodeChannel {
299
300
}
300
301
301
302
_handleConnectionTerminated ( ) {
302
- this . _error = new Error ( 'Connection was closed by server' ) ;
303
- if ( this . onerror ) {
304
- this . onerror ( this . _error ) ;
305
- }
303
+ this . _open = false ;
304
+ this . _conn = undefined ;
306
305
}
307
306
308
307
isEncrypted ( ) {
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ class Pool {
46
46
47
47
if ( this . _validate ( resource ) ) {
48
48
return resource ;
49
+ } else {
50
+ this . _destroy ( resource ) ;
49
51
}
50
52
}
51
53
You can’t perform that action at this time.
0 commit comments