Fix races where Socket is closed before Websocket is created

This commit is contained in:
artur 2023-02-01 16:37:17 +03:00
parent 1b4ac0d711
commit 1ade8e175f
1 changed files with 5 additions and 0 deletions

View File

@ -107,6 +107,11 @@ export default class Connection {
console.warn("Could not load relay information", e);
}
if (this.IsClosed) {
this._UpdateState();
return;
}
this.IsClosed = false;
this.Socket = new WebSocket(this.Address);
this.Socket.onopen = (e) => this.OnOpen(e);