[#112] Fix race condition with closing sessions
This commit is contained in:
parent
3fa023285b
commit
d46b86c631
|
@ -155,6 +155,11 @@ export class Session {
|
|||
logError(err);
|
||||
await this.teardown();
|
||||
});
|
||||
// User may have closed websocket before we were able to set up
|
||||
// the onclose listener.
|
||||
if (this.ws.readyState === WebSocket.CLOSED) {
|
||||
await this.teardown();
|
||||
}
|
||||
} catch (err) {
|
||||
logError(err);
|
||||
this.sendError(err);
|
||||
|
|
Loading…
Reference in New Issue