From 1dde93b9da3abfc6464977b1843313897ee9d6ff Mon Sep 17 00:00:00 2001 From: luson Date: Mon, 14 Jan 2019 17:01:37 +0800 Subject: [PATCH] Update heartbeat.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复设置了heartbeat,心跳disconnectOnTimeout总为true的问题 --- lib/connectors/commands/heartbeat.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/connectors/commands/heartbeat.js b/lib/connectors/commands/heartbeat.js index 213ce4efc..de1824734 100644 --- a/lib/connectors/commands/heartbeat.js +++ b/lib/connectors/commands/heartbeat.js @@ -11,12 +11,11 @@ var Command = function(opts) { opts = opts || {}; this.heartbeat = null; this.timeout = null; - this.disconnectOnTimeout = opts.disconnectOnTimeout; + this.disconnectOnTimeout = !!opts.disconnectOnTimeout; if(opts.heartbeat) { this.heartbeat = opts.heartbeat * 1000; // heartbeat interval this.timeout = opts.timeout * 1000 || this.heartbeat * 2; // max heartbeat message timeout - this.disconnectOnTimeout = true; } this.timeouts = {};