Fix crash on hartbeat on closing connection

Fix heartbeat incorrectly asserting it cannot be sent on a connection in
the closing state.
This commit is contained in:
Hornwitser committed 2020-05-08 18:09:48 +02:00
1 parent b151dd8469
commit 1beffb1bfd
1 file changed
+1 -1
+1 -1
View File
@@ -43,7 +43,7 @@ class WebSocketBaseConnector extends events.EventEmitter {
} }
_doHeartbeat() { _doHeartbeat() {
this._check(["connected"]); this._check(["connected", "closing"]);
if (Date.now() - this._lastHeartbeat > 2000 * this._heartbeatInterval) { if (Date.now() - this._lastHeartbeat > 2000 * this._heartbeatInterval) {
console.log("SOCKET | closing after heartbeat timed out"); console.log("SOCKET | closing after heartbeat timed out");
this._socket.close(1008, "Heartbeat timeout"); this._socket.close(1008, "Heartbeat timeout");