File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -258,9 +258,13 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
258
258
stream . on ( 'close' , ( ) => this . handleIssue ( { isClose : true } ) ) ;
259
259
260
260
stream . on ( 'timeout' , ( ) => {
261
- this . delayedTimeoutErrorId = setTimeout ( ( ) => {
262
- this . handleIssue ( { isTimeout : true , destroy : true } ) ;
263
- } , 1 ) ;
261
+ if ( this . delayedTimeoutErrorId != null ) {
262
+ this . delayedTimeoutErrorId . refresh ( ) ;
263
+ } else {
264
+ this . delayedTimeoutErrorId = setTimeout ( ( ) => {
265
+ this . handleIssue ( { isTimeout : true , destroy : true } ) ;
266
+ } , 1 ) ;
267
+ }
264
268
} ) ;
265
269
266
270
// hook the message stream up to the passed in stream
@@ -718,7 +722,6 @@ function messageHandler(conn: Connection) {
718
722
return function messageHandler ( message : BinMsg | Response ) {
719
723
if ( conn . delayedTimeoutErrorId != null ) {
720
724
clearTimeout ( conn . delayedTimeoutErrorId ) ;
721
- conn . delayedTimeoutErrorId = null ;
722
725
}
723
726
724
727
// always emit the message, in case we are streaming
You can’t perform that action at this time.
0 commit comments