Do not emit 'end' twice from Connection on close

This commit is contained in:
Sandro Santilli 2014-04-04 10:07:07 +02:00
parent 96e4afdb1b
commit e1b1c62e3e

View File

@ -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');
});