File tree 1 file changed +9
-3
lines changed 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -88,10 +88,16 @@ var passes = exports;
88
88
common . setupOutgoing ( options . ssl || { } , options , req )
89
89
) ;
90
90
// Error Handler
91
- proxyReq . on ( 'error' , onError ) ;
91
+ proxyReq . on ( 'error' , onOutgoingError ) ;
92
92
93
93
proxyReq . on ( 'upgrade' , function ( proxyRes , proxySocket , proxyHead ) {
94
- proxySocket . on ( 'error' , onError ) ;
94
+ proxySocket . on ( 'error' , onOutgoingError ) ;
95
+ // The pipe below will end proxySocket if socket closes cleanly, but not
96
+ // if it errors (eg, vanishes from the net and starts returning
97
+ // EHOSTUNREACH). We need to do that explicitly.
98
+ socket . on ( 'error' , function ( ) {
99
+ proxySocket . end ( ) ;
100
+ } ) ;
95
101
96
102
common . setupSocket ( proxySocket ) ;
97
103
@@ -106,7 +112,7 @@ var passes = exports;
106
112
107
113
return proxyReq . end ( ) ; // XXX: CHECK IF THIS IS THIS CORRECT
108
114
109
- function onError ( err ) {
115
+ function onOutgoingError ( err ) {
110
116
if ( clb ) {
111
117
clb ( err , req , socket ) ;
112
118
} else {
You can’t perform that action at this time.
0 commit comments