Skip to content

Commit

Permalink
Break reconnect loop if you client.destroy in the disconnect event (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
bdistin authored and iCrawl committed Apr 12, 2017
1 parent 39f7dc0 commit c5e2ea7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/client/websocket/WebSocketManager.js
Expand Up @@ -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();
Expand Down

0 comments on commit c5e2ea7

Please sign in to comment.