File tree 1 file changed +4
-11
lines changed
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) {
62
62
self . emit ( 'connect' )
63
63
} )
64
64
65
- this . stream . on ( 'error' , function ( error ) {
65
+ const reportStreamError = function ( error ) {
66
66
// don't raise ECONNRESET errors - they can & should be ignored
67
67
// during disconnect
68
68
if ( self . _ending && error . code === 'ECONNRESET' ) {
69
69
return
70
70
}
71
71
self . emit ( 'error' , error )
72
- } )
72
+ }
73
+ this . stream . on ( 'error' , reportStreamError )
73
74
74
75
this . stream . on ( 'close' , function ( ) {
75
76
self . emit ( 'end' )
@@ -97,15 +98,7 @@ Connection.prototype.connect = function (port, host) {
97
98
NPNProtocols : self . ssl . NPNProtocols
98
99
} )
99
100
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 )
109
102
110
103
self . emit ( 'sslconnect' )
111
104
} )
You can’t perform that action at this time.
0 commit comments