Merge pull request #186 from brugeman/main

Fix races where Socket is closed before Websocket is created
This commit is contained in:
Kieran 2023-02-01 19:20:21 +00:00 committed by GitHub
commit 508d961a10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);