mirror of https://github.com/nodejs/node.git
'connect' event may disconnect socket
parent
42357645cb
commit
02039c9b53
12
lib/net.js
12
lib/net.js
|
@ -367,6 +367,12 @@ Stream.prototype._onConnect = function () {
|
||||||
this._connecting = false;
|
this._connecting = false;
|
||||||
this.resume();
|
this.resume();
|
||||||
this.readable = this.writable = true;
|
this.readable = this.writable = true;
|
||||||
|
|
||||||
|
if (this._writeWatcher.firstBucket) {
|
||||||
|
// Flush this in case any writes are queued up while connecting.
|
||||||
|
this._onWritable();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.emit('connect');
|
this.emit('connect');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -374,12 +380,6 @@ Stream.prototype._onConnect = function () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this._writeWatcher.firstBucket) {
|
|
||||||
// Flush this in case any writes are queued up while connecting.
|
|
||||||
this._onWritable();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (errno != EINPROGRESS) {
|
} else if (errno != EINPROGRESS) {
|
||||||
this.destroy(errnoException(errno, 'connect'));
|
this.destroy(errnoException(errno, 'connect'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue