@@ -1120,6 +1120,8 @@ class Http2Session extends EventEmitter {
1120
1120
if ( ! socket . _handle || ! socket . _handle . isStreamBase ) {
1121
1121
socket = new JSStreamSocket ( socket ) ;
1122
1122
}
1123
+ socket . on ( 'error' , socketOnError ) ;
1124
+ socket . on ( 'close' , socketOnClose ) ;
1123
1125
1124
1126
// No validation is performed on the input parameters because this
1125
1127
// constructor is not exported directly for users.
@@ -2887,9 +2889,6 @@ function connectionListener(socket) {
2887
2889
return ;
2888
2890
}
2889
2891
2890
- socket . on ( 'error' , socketOnError ) ;
2891
- socket . on ( 'close' , socketOnClose ) ;
2892
-
2893
2892
// Set up the Session
2894
2893
const session = new ServerHttp2Session ( options , socket , this ) ;
2895
2894
@@ -3100,12 +3099,6 @@ function connect(authority, options, listener) {
3100
3099
3101
3100
const session = new ClientHttp2Session ( options , socket ) ;
3102
3101
3103
- // ClientHttp2Session may create a new socket object
3104
- // when socket is a JSSocket (socket != kSocket)
3105
- // https://github.com/nodejs/node/issues/35695
3106
- session [ kSocket ] . on ( 'error' , socketOnError ) ;
3107
- session [ kSocket ] . on ( 'close' , socketOnClose ) ;
3108
-
3109
3102
session [ kAuthority ] = `${ options . servername || host } :${ port } ` ;
3110
3103
session [ kProtocol ] = protocol ;
3111
3104
0 commit comments