mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 05:52:05 +00:00
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
This commit is contained in:
parent
39f7dc018a
commit
c5e2ea7458
1 changed files with 5 additions and 1 deletions
|
|
@ -307,7 +307,11 @@ class WebSocketManager extends EventEmitter {
|
||||||
* Tries to reconnect the client, changing the status to Constants.Status.RECONNECTING.
|
* Tries to reconnect the client, changing the status to Constants.Status.RECONNECTING.
|
||||||
*/
|
*/
|
||||||
tryReconnect() {
|
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.status = Constants.Status.RECONNECTING;
|
||||||
this.ws.close();
|
this.ws.close();
|
||||||
this.packetManager.handleQueue();
|
this.packetManager.handleQueue();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue