Have Connection also emit 'end' on stream 'close' event
Should fix missing connect callback call with node-0.8 (#534)
This commit is contained in:
parent
d21b995726
commit
96e4afdb1b
@ -60,6 +60,13 @@ Connection.prototype.connect = function(port, host) {
|
|||||||
self.emit('end');
|
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
|
||||||
|
self.emit('end');
|
||||||
|
});
|
||||||
|
|
||||||
if(!this.ssl) {
|
if(!this.ssl) {
|
||||||
return this.attachListeners(this.stream);
|
return this.attachListeners(this.stream);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user