@@ -177,6 +177,7 @@ const {
177
177
kUpdateTimer,
178
178
kHandle,
179
179
kSession,
180
+ kBoundSession,
180
181
setStreamTimeout,
181
182
} = require ( 'internal/stream_base_commons' ) ;
182
183
const { kTimeout } = require ( 'internal/timers' ) ;
@@ -1121,7 +1122,7 @@ function cleanupSession(session) {
1121
1122
if ( handle )
1122
1123
handle . ondone = null ;
1123
1124
if ( socket ) {
1124
- socket [ kSession ] = undefined ;
1125
+ socket [ kBoundSession ] = undefined ;
1125
1126
socket [ kServer ] = undefined ;
1126
1127
}
1127
1128
}
@@ -1235,10 +1236,10 @@ class Http2Session extends EventEmitter {
1235
1236
// If the session property already exists on the socket,
1236
1237
// then it has already been bound to an Http2Session instance
1237
1238
// and cannot be attached again.
1238
- if ( socket [ kSession ] !== undefined )
1239
+ if ( socket [ kBoundSession ] !== undefined )
1239
1240
throw new ERR_HTTP2_SOCKET_BOUND ( ) ;
1240
1241
1241
- socket [ kSession ] = this ;
1242
+ socket [ kBoundSession ] = this ;
1242
1243
1243
1244
if ( ! socket . _handle || ! socket . _handle . isStreamBase ) {
1244
1245
socket = new JSStreamSocket ( socket ) ;
@@ -1617,7 +1618,7 @@ class Http2Session extends EventEmitter {
1617
1618
}
1618
1619
1619
1620
_onTimeout ( ) {
1620
- callTimeout ( this ) ;
1621
+ callTimeout ( this , this ) ;
1621
1622
}
1622
1623
1623
1624
ref ( ) {
@@ -2093,7 +2094,7 @@ class Http2Stream extends Duplex {
2093
2094
}
2094
2095
2095
2096
_onTimeout ( ) {
2096
- callTimeout ( this , kSession ) ;
2097
+ callTimeout ( this , this [ kSession ] ) ;
2097
2098
}
2098
2099
2099
2100
// True if the HEADERS frame has been sent
@@ -2419,7 +2420,7 @@ class Http2Stream extends Duplex {
2419
2420
}
2420
2421
}
2421
2422
2422
- function callTimeout ( self , kSession ) {
2423
+ function callTimeout ( self , session ) {
2423
2424
// If the session is destroyed, this should never actually be invoked,
2424
2425
// but just in case...
2425
2426
if ( self . destroyed )
@@ -2430,7 +2431,7 @@ function callTimeout(self, kSession) {
2430
2431
// happens, meaning that if a write is ongoing it should never equal the
2431
2432
// newly fetched, updated value.
2432
2433
if ( self [ kState ] . writeQueueSize > 0 ) {
2433
- const handle = kSession ? self [ kSession ] [ kHandle ] : self [ kHandle ] ;
2434
+ const handle = session [ kHandle ] ;
2434
2435
const chunksSentSinceLastWrite = handle !== undefined ?
2435
2436
handle . chunksSentSinceLastWrite : null ;
2436
2437
if ( chunksSentSinceLastWrite !== null &&
@@ -3017,7 +3018,7 @@ ObjectDefineProperty(Http2Session.prototype, 'setTimeout', setTimeoutValue);
3017
3018
// When the socket emits an error, destroy the associated Http2Session and
3018
3019
// forward it the same error.
3019
3020
function socketOnError ( error ) {
3020
- const session = this [ kSession ] ;
3021
+ const session = this [ kBoundSession ] ;
3021
3022
if ( session !== undefined ) {
3022
3023
// We can ignore ECONNRESET after GOAWAY was received as there's nothing
3023
3024
// we can do and the other side is fully within its rights to do so.
@@ -3300,7 +3301,7 @@ function setupCompat(ev) {
3300
3301
}
3301
3302
3302
3303
function socketOnClose ( ) {
3303
- const session = this [ kSession ] ;
3304
+ const session = this [ kBoundSession ] ;
3304
3305
if ( session !== undefined ) {
3305
3306
debugSessionObj ( session , 'socket closed' ) ;
3306
3307
const err = session . connecting ? new ERR_SOCKET_CLOSED ( ) : null ;
0 commit comments