File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -529,8 +529,9 @@ Socket.prototype._unrefTimer = function _unrefTimer() {
529529// sent out to the other side.
530530Socket . prototype . _final = function ( cb ) {
531531 // If still connecting - defer handling `_final` until 'connect' will happen
532- if ( this . connecting ) {
532+ if ( this . connecting && ! this . _finalizingOnConnect ) {
533533 debug ( '_final: not yet connected' ) ;
534+ this . _finalizingOnConnect = true ;
534535 return this . once ( 'connect' , ( ) => this . _final ( cb ) ) ;
535536 }
536537
@@ -800,8 +801,10 @@ Socket.prototype.destroySoon = function() {
800801
801802 if ( this . writableFinished )
802803 this . destroy ( ) ;
803- else
804+ else if ( ! this . _destroyingOnFinish ) {
805+ this . _destroyingOnFinish = true ;
804806 this . once ( 'finish' , this . destroy ) ;
807+ }
805808} ;
806809
807810
You can’t perform that action at this time.
0 commit comments