Skip to content

Commit a70ef63

Browse files
committed
return from _final when connecting even if no listeners added
1 parent ae5739e commit a70ef63

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/net.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,13 @@ Socket.prototype._unrefTimer = function _unrefTimer() {
529529
// sent out to the other side.
530530
Socket.prototype._final = function(cb) {
531531
// If still connecting - defer handling `_final` until 'connect' will happen
532-
if (this.connecting && !this._finalizingOnConnect) {
532+
if (this.connecting) {
533533
debug('_final: not yet connected');
534-
this._finalizingOnConnect = true;
535-
return this.once('connect', () => this._final(cb));
534+
if (!this._finalizingOnConnect) {
535+
this._finalizingOnConnect = true;
536+
this.once('connect', () => this._final(cb));
537+
}
538+
return;
536539
}
537540

538541
if (!this._handle)

0 commit comments

Comments
 (0)