From e62f17fb4482f3a51ad04bc761aad22806585d95 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 14 Mar 2025 12:53:23 +0000 Subject: [PATCH] wait for two times the advertised idle interval before closing connection --- lib/connection.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/connection.js b/lib/connection.js index 381651b..c7887a1 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -515,7 +515,7 @@ Connection.prototype.output = function () { this.heartbeat_out = setTimeout(this._write_frame.bind(this), this.remote.open.idle_time_out / 2); } if (this.local.open.idle_time_out && this.heartbeat_in === undefined) { - this.heartbeat_in = setTimeout(this.idle.bind(this), this.local.open.idle_time_out); + this.heartbeat_in = setTimeout(this.idle.bind(this), this.local.open.idle_time_out * 2); } } } catch (e) { @@ -577,7 +577,7 @@ Connection.prototype.input = function (buff) { this.previous_input = previous_input; } } - if (this.local.open.idle_time_out) this.heartbeat_in = setTimeout(this.idle.bind(this), this.local.open.idle_time_out); + if (this.local.open.idle_time_out) this.heartbeat_in = setTimeout(this.idle.bind(this), this.local.open.idle_time_out * 2); if (this.transport.has_writes_pending()) { this.output(); } else if (this.is_closed() && this.state.has_settled()) {