Skip to content

Commit 8276221

Browse files
committed
fix(connection): ensure pooled connections get released
The PoolConnection is listening for the end event to be emitted to close the connection, but the connection is not listening to the underlying end event emitted by the net.Socket.
1 parent 1eef0a7 commit 8276221

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/connection.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ class Connection extends EventEmitter {
9696
}
9797
this.packetParser.execute(data);
9898
});
99+
this.stream.on('end', ()=>{
100+
// emit the end event so that the pooled connection can close the connection
101+
this.emit('end');
102+
});
99103
this.stream.on('close', () => {
100104
// we need to set this flag everywhere where we want connection to close
101105
if (this._closing) {

0 commit comments

Comments
 (0)