We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
connect
finish
1 parent fb34515 commit 524d5c5Copy full SHA for 524d5c5
1 file changed
lib/net.js
@@ -529,8 +529,9 @@ Socket.prototype._unrefTimer = function _unrefTimer() {
529
// sent out to the other side.
530
Socket.prototype._final = function(cb) {
531
// If still connecting - defer handling `_final` until 'connect' will happen
532
- if (this.connecting) {
+ if (this.connecting && !this._finalizingOnConnect) {
533
debug('_final: not yet connected');
534
+ this._finalizingOnConnect = true;
535
return this.once('connect', () => this._final(cb));
536
}
537
@@ -800,8 +801,10 @@ Socket.prototype.destroySoon = function() {
800
801
802
if (this.writableFinished)
803
this.destroy();
- else
804
+ else if (!this._destroyingOnFinish) {
805
+ this._destroyingOnFinish = true;
806
this.once('finish', this.destroy);
807
+ }
808
};
809
810
0 commit comments