@@ -500,8 +500,6 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
500
500
}
501
501
catch ( ex ) {
502
502
detach ( ) ;
503
- reverseProxy . incoming . socket . end ( ) ;
504
- proxySocket . end ( ) ;
505
503
}
506
504
}
507
505
} ) ;
@@ -532,8 +530,6 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
532
530
}
533
531
catch ( ex ) {
534
532
detach ( ) ;
535
- proxySocket . end ( ) ;
536
- socket . end ( ) ;
537
533
}
538
534
} ) ;
539
535
@@ -542,8 +538,10 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
542
538
// from `reverseProxy` and `proxySocket`.
543
539
//
544
540
function detach ( ) {
541
+ proxySocket . destroySoon ( ) ;
545
542
proxySocket . removeListener ( 'end' , listeners . onIncomingClose ) ;
546
543
proxySocket . removeListener ( 'data' , listeners . onIncoming ) ;
544
+ reverseProxy . incoming . socket . destroySoon ( ) ;
547
545
reverseProxy . incoming . socket . removeListener ( 'end' , listeners . onOutgoingClose ) ;
548
546
reverseProxy . incoming . socket . removeListener ( 'data' , listeners . onOutgoing ) ;
549
547
}
@@ -553,7 +551,6 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
553
551
// detach all event listeners.
554
552
//
555
553
proxySocket . on ( 'end' , listeners . onIncomingClose = function ( ) {
556
- reverseProxy . incoming . socket . end ( ) ;
557
554
detach ( ) ;
558
555
559
556
// Emit the `end` event now that we have completed proxying
@@ -565,7 +562,6 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
565
562
// event listeners.
566
563
//
567
564
reverseProxy . incoming . socket . on ( 'end' , listeners . onOutgoingClose = function ( ) {
568
- proxySocket . end ( ) ;
569
565
detach ( ) ;
570
566
} ) ;
571
567
}
0 commit comments