File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,13 @@ function PoolConnection (pool, options) {
13
13
// When a fatal error occurs the connection's protocol ends, which will cause
14
14
// the connection to end as well, thus we only need to watch for the end event
15
15
// and we will be notified of disconnects.
16
- this . on ( 'end' , this . _removeFromPool ) ;
17
- this . on ( 'error' , this . _removeFromPool ) ;
16
+ var connection = this ;
17
+ this . on ( 'end' , function ( err ) {
18
+ this . _removeFromPool ( ) ;
19
+ } ) ;
20
+ this . on ( 'error' , function ( err ) {
21
+ this . _removeFromPool ( ) ;
22
+ } ) ;
18
23
}
19
24
20
25
PoolConnection . prototype . release = function ( ) {
@@ -38,11 +43,11 @@ PoolConnection.prototype.end = function () {
38
43
} ;
39
44
40
45
PoolConnection . prototype . destroy = function ( ) {
41
- this . _removeFromPool ( this ) ;
46
+ this . _removeFromPool ( ) ;
42
47
return Connection . prototype . destroy . apply ( this , arguments ) ;
43
48
} ;
44
49
45
- PoolConnection . prototype . _removeFromPool = function ( connection ) {
50
+ PoolConnection . prototype . _removeFromPool = function ( ) {
46
51
if ( ! this . _pool || this . _pool . _closed ) {
47
52
return ;
48
53
}
You can’t perform that action at this time.
0 commit comments