diff --git a/lib/connection.js b/lib/connection.js index ba34ad3..96c77cc 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -545,7 +545,10 @@ Connection.prototype.eof = function (e) { }; Connection.prototype._disconnected = function (error) { - if (this.heartbeat_out) clearTimeout(this.heartbeat_out); + if (this.heartbeat_out) { + clearTimeout(this.heartbeat_out); + this.heartbeat_out = undefined; + } if (this.heartbeat_in) clearTimeout(this.heartbeat_in); var was_closed_with_non_fatal_error = this.closed_with_non_fatal_error; if (this.closed_with_non_fatal_error) {