diff --git a/lib/connection.js b/lib/connection.js index e2720be078..0733b11c62 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -96,6 +96,10 @@ class Connection extends EventEmitter { } this.packetParser.execute(data); }); + this.stream.on('end', () => { + // emit the end event so that the pooled connection can close the connection + this.emit('end'); + }); this.stream.on('close', () => { // we need to set this flag everywhere where we want connection to close if (this._closing) {