@@ -177,6 +177,7 @@ const {
177177 kUpdateTimer,
178178 kHandle,
179179 kSession,
180+ kBoundSession,
180181 setStreamTimeout,
181182} = require ( 'internal/stream_base_commons' ) ;
182183const { kTimeout } = require ( 'internal/timers' ) ;
@@ -1121,7 +1122,7 @@ function cleanupSession(session) {
11211122 if ( handle )
11221123 handle . ondone = null ;
11231124 if ( socket ) {
1124- socket [ kSession ] = undefined ;
1125+ socket [ kBoundSession ] = undefined ;
11251126 socket [ kServer ] = undefined ;
11261127 }
11271128}
@@ -1235,10 +1236,10 @@ class Http2Session extends EventEmitter {
12351236 // If the session property already exists on the socket,
12361237 // then it has already been bound to an Http2Session instance
12371238 // and cannot be attached again.
1238- if ( socket [ kSession ] !== undefined )
1239+ if ( socket [ kBoundSession ] !== undefined )
12391240 throw new ERR_HTTP2_SOCKET_BOUND ( ) ;
12401241
1241- socket [ kSession ] = this ;
1242+ socket [ kBoundSession ] = this ;
12421243
12431244 if ( ! socket . _handle || ! socket . _handle . isStreamBase ) {
12441245 socket = new JSStreamSocket ( socket ) ;
@@ -1617,7 +1618,7 @@ class Http2Session extends EventEmitter {
16171618 }
16181619
16191620 _onTimeout ( ) {
1620- callTimeout ( this ) ;
1621+ callTimeout ( this , this ) ;
16211622 }
16221623
16231624 ref ( ) {
@@ -2093,7 +2094,7 @@ class Http2Stream extends Duplex {
20932094 }
20942095
20952096 _onTimeout ( ) {
2096- callTimeout ( this , kSession ) ;
2097+ callTimeout ( this , this [ kSession ] ) ;
20972098 }
20982099
20992100 // True if the HEADERS frame has been sent
@@ -2419,7 +2420,7 @@ class Http2Stream extends Duplex {
24192420 }
24202421}
24212422
2422- function callTimeout ( self , kSession ) {
2423+ function callTimeout ( self , session ) {
24232424 // If the session is destroyed, this should never actually be invoked,
24242425 // but just in case...
24252426 if ( self . destroyed )
@@ -2430,7 +2431,7 @@ function callTimeout(self, kSession) {
24302431 // happens, meaning that if a write is ongoing it should never equal the
24312432 // newly fetched, updated value.
24322433 if ( self [ kState ] . writeQueueSize > 0 ) {
2433- const handle = kSession ? self [ kSession ] [ kHandle ] : self [ kHandle ] ;
2434+ const handle = session [ kHandle ] ;
24342435 const chunksSentSinceLastWrite = handle !== undefined ?
24352436 handle . chunksSentSinceLastWrite : null ;
24362437 if ( chunksSentSinceLastWrite !== null &&
@@ -3017,7 +3018,7 @@ ObjectDefineProperty(Http2Session.prototype, 'setTimeout', setTimeoutValue);
30173018// When the socket emits an error, destroy the associated Http2Session and
30183019// forward it the same error.
30193020function socketOnError ( error ) {
3020- const session = this [ kSession ] ;
3021+ const session = this [ kBoundSession ] ;
30213022 if ( session !== undefined ) {
30223023 // We can ignore ECONNRESET after GOAWAY was received as there's nothing
30233024 // we can do and the other side is fully within its rights to do so.
@@ -3300,7 +3301,7 @@ function setupCompat(ev) {
33003301}
33013302
33023303function socketOnClose ( ) {
3303- const session = this [ kSession ] ;
3304+ const session = this [ kBoundSession ] ;
33043305 if ( session !== undefined ) {
33053306 debugSessionObj ( session , 'socket closed' ) ;
33063307 const err = session . connecting ? new ERR_SOCKET_CLOSED ( ) : null ;
0 commit comments