File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -62,14 +62,15 @@ Connection.prototype.connect = function (port, host) {
6262 self . emit ( 'connect' )
6363 } )
6464
65- this . stream . on ( 'error' , function ( error ) {
65+ const reportStreamError = function ( error ) {
6666 // don't raise ECONNRESET errors - they can & should be ignored
6767 // during disconnect
6868 if ( self . _ending && error . code === 'ECONNRESET' ) {
6969 return
7070 }
7171 self . emit ( 'error' , error )
72- } )
72+ }
73+ this . stream . on ( 'error' , reportStreamError )
7374
7475 this . stream . on ( 'close' , function ( ) {
7576 self . emit ( 'end' )
@@ -97,15 +98,7 @@ Connection.prototype.connect = function (port, host) {
9798 NPNProtocols : self . ssl . NPNProtocols
9899 } )
99100 self . attachListeners ( self . stream )
100-
101- self . stream . on ( 'error' , function ( error ) {
102- // don't raise ECONNRESET errors - they can & should be ignored
103- // during disconnect
104- if ( self . _ending && error . code === 'ECONNRESET' ) {
105- return
106- }
107- self . emit ( 'error' , error )
108- } )
101+ self . stream . on ( 'error' , reportStreamError )
109102
110103 self . emit ( 'sslconnect' )
111104 } )
You can’t perform that action at this time.
0 commit comments