From e7d5d1caa1fcab9febd24ef5ab6b6ce4a79aa94d Mon Sep 17 00:00:00 2001 From: GreenAsJade Date: Tue, 3 Oct 2023 17:19:20 +1030 Subject: [PATCH] Don't keep reseting the ping interval every time, remember that we changed it. --- src/GobanSocket.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GobanSocket.ts b/src/GobanSocket.ts index 16522b42..a7ca88b1 100644 --- a/src/GobanSocket.ts +++ b/src/GobanSocket.ts @@ -164,9 +164,11 @@ export class GobanSocket< drift: this.clock_drift, latency: this.latency, } as DataArgument); + if (this.options.timeout_delay) { this.timeout_timer = setTimeout(this.signalTimeout, this.options.timeout_delay); } + if ( this.options.ping_interval && this.options.ping_interval !== this.current_ping_interval @@ -176,6 +178,7 @@ export class GobanSocket< this.ping, this.options.ping_interval || DEFAULT_PING_INTERVAL, ); + this.current_ping_interval = this.options.ping_interval; } } else { if (this.ping_timer) {