Skip to content

Commit e1b1c62

Browse files
author
Sandro Santilli
committed
Do not emit 'end' twice from Connection on close
1 parent 96e4afd commit e1b1c62

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/connection.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,10 @@ Connection.prototype.connect = function(port, host) {
5656
self.emit('error', error);
5757
});
5858

59-
this.stream.on('end', function() {
60-
self.emit('end');
61-
});
62-
6359
this.stream.on('close', function() {
64-
// TODO: avoid emitting 'end' twice ?
65-
// node-0.10 emits both 'end' and 'close'
66-
// for streams closed by the peer
60+
// NOTE: node-0.10 emits both 'end' and 'close'
61+
// for streams closed by the peer, while
62+
// node-0.8 only emits 'close'
6763
self.emit('end');
6864
});
6965

0 commit comments

Comments
 (0)