mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01: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:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user