*Check if socket exists before closing to prevent errors on possible race conditions
This commit is contained in:
parent
43041160be
commit
4f21ab970d
|
@ -150,8 +150,12 @@ export class Socket extends EventEmitter {
|
|||
}
|
||||
|
||||
end(): void {
|
||||
callModule(DHT_MODULE, "socketExists", { id: this.id }).then(([exists]: ErrTuple) => {
|
||||
if (exists) {
|
||||
callModule(DHT_MODULE, "close", { id: this.id });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ensureEvent(event: string): void {
|
||||
if (!(event in this.eventUpdates)) {
|
||||
|
|
Loading…
Reference in New Issue