Clear socket buffer on reconnect
This commit is contained in:
parent
c359d3f319
commit
e928541370
@ -88,7 +88,7 @@ class Session extends EventEmitter {
|
|||||||
this.socket.on("force_update", this._handleForceUpdate.bind(this));
|
this.socket.on("force_update", this._handleForceUpdate.bind(this));
|
||||||
|
|
||||||
this.emit("status", "ready");
|
this.emit("status", "ready");
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
logError(error);
|
logError(error);
|
||||||
this.emit("status", "offline");
|
this.emit("status", "offline");
|
||||||
}
|
}
|
||||||
@ -302,7 +302,7 @@ class Session extends EventEmitter {
|
|||||||
this.peers[id] = peer;
|
this.peers[id] = peer;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
logError(error);
|
logError(error);
|
||||||
this.emit("peerError", { error });
|
this.emit("peerError", { error });
|
||||||
for (let peer of Object.values(this.peers)) {
|
for (let peer of Object.values(this.peers)) {
|
||||||
@ -360,6 +360,7 @@ class Session extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_handleSocketReconnect() {
|
_handleSocketReconnect() {
|
||||||
|
this.socket.sendBuffer = [];
|
||||||
if (this._gameId) {
|
if (this._gameId) {
|
||||||
this.joinGame(this._gameId, this._password);
|
this.joinGame(this._gameId, this._password);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user