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