File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -316,6 +316,9 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
316
316
this [ kDelayedTimeoutId ] = null ;
317
317
}
318
318
319
+ const socketTimeoutMS = this [ kStream ] . timeout ?? 0 ;
320
+ this [ kStream ] . setTimeout ( 0 ) ;
321
+
319
322
// always emit the message, in case we are streaming
320
323
this . emit ( 'message' , message ) ;
321
324
let operationDescription = this [ kQueue ] . get ( message . responseTo ) ;
@@ -341,7 +344,6 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
341
344
}
342
345
343
346
if ( ! operationDescription ) {
344
- this [ kStream ] . setTimeout ( 0 ) ;
345
347
return ;
346
348
}
347
349
@@ -357,8 +359,7 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
357
359
// back in the queue with the correct requestId and will resolve not being able
358
360
// to find the next one via the responseTo of the next streaming hello.
359
361
this [ kQueue ] . set ( message . requestId , operationDescription ) ;
360
- } else {
361
- this [ kStream ] . setTimeout ( 0 ) ;
362
+ this [ kStream ] . setTimeout ( socketTimeoutMS ) ;
362
363
}
363
364
364
365
try {
Original file line number Diff line number Diff line change @@ -499,6 +499,7 @@ describe('new Connection()', function () {
499
499
} ;
500
500
const msgBody = msg . subarray ( 16 ) ;
501
501
msgBody . writeInt32LE ( 2 , 0 ) ; // OPTS_MORE_TO_COME
502
+ connection [ getSymbolFrom ( connection , 'queue' ) ] . set ( 0 , { cb : ( ) => null } ) ;
502
503
connection . onMessage ( new BinMsg ( msg , msgHeader , msgBody ) ) ;
503
504
// timeout is still set
504
505
expect ( connection . stream ) . to . have . property ( 'timeout' , 1 ) ;
You can’t perform that action at this time.
0 commit comments