From e1b1c62e3e57e6b3b329baa1d48a89752c238b4f Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 4 Apr 2014 10:07:07 +0200 Subject: [PATCH] Do not emit 'end' twice from Connection on close --- lib/connection.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/connection.js b/lib/connection.js index 997b0a73..c5fc1696 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -56,14 +56,10 @@ Connection.prototype.connect = function(port, host) { self.emit('error', error); }); - this.stream.on('end', function() { - self.emit('end'); - }); - this.stream.on('close', function() { - // TODO: avoid emitting 'end' twice ? - // node-0.10 emits both 'end' and 'close' - // for streams closed by the peer + // NOTE: node-0.10 emits both 'end' and 'close' + // for streams closed by the peer, while + // node-0.8 only emits 'close' self.emit('end'); });