File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,13 @@ module.exports = class ProxyServer extends Nanoresource {
3030
3131 this [ kServer ] . on ( 'request' , onRequest ( proxy . web . bind ( proxy ) ) )
3232 this [ kServer ] . on ( 'upgrade' , onRequest ( proxy . ws . bind ( proxy ) ) )
33+ this [ kServer ] . on ( 'error' , ignorePrematureClose )
3334
3435 enableDestroy ( this [ kServer ] )
36+
3537 proxy . on ( 'proxyReq' , onProxyReq )
38+ proxy . on ( 'error' , ignorePrematureClose )
39+ proxy . onError = ignorePrematureClose
3640
3741 function onProxyReq ( proxyReq , req , res , options ) {
3842 proxyReq . setHeader ( 'x-airtap-context-id' , cid )
@@ -85,6 +89,14 @@ module.exports = class ProxyServer extends Nanoresource {
8589 }
8690}
8791
92+ function ignorePrematureClose ( err ) {
93+ if ( err . code === 'ECONNRESET' ) {
94+ debug ( 'Socket closed prematurely' )
95+ } else {
96+ throw err
97+ }
98+ }
99+
88100function maybeLookup ( hostname , opts , callback ) {
89101 if ( hostname === ip ) {
90102 process . nextTick ( callback , null , ip )
You can’t perform that action at this time.
0 commit comments