From c5e2ea74582c310ac97f1618b097df6efda2ef45 Mon Sep 17 00:00:00 2001 From: bdistin Date: Tue, 11 Apr 2017 23:31:45 -0500 Subject: [PATCH] Break reconnect loop if you client.destroy in the disconnect event (#1371) * Break reconnect loop if you client.destroy in the disconnect event * fix lint/long line? * God this is So UGLY, why... * Update WebSocketManager.js * Update WebSocketManager.js --- src/client/websocket/WebSocketManager.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/websocket/WebSocketManager.js b/src/client/websocket/WebSocketManager.js index 3c0f45edc..6c8266e4e 100644 --- a/src/client/websocket/WebSocketManager.js +++ b/src/client/websocket/WebSocketManager.js @@ -307,7 +307,11 @@ class WebSocketManager extends EventEmitter { * Tries to reconnect the client, changing the status to Constants.Status.RECONNECTING. */ tryReconnect() { - if (this.status === Constants.Status.RECONNECTING || this.status === Constants.Status.CONNECTING) return; + if ( + this.status === Constants.Status.RECONNECTING || + this.status === Constants.Status.CONNECTING || + !this.client.token + ) return; this.status = Constants.Status.RECONNECTING; this.ws.close(); this.packetManager.handleQueue();