This commit is contained in:
Egor Aristov 2025-11-16 09:23:46 +03:00
parent 7f0d7047e9
commit 510e0a108d
Signed by: egor3f
GPG Key ID: 40482A264AAEC85F

View File

@ -169,17 +169,6 @@ abstract class IPCCommon {
callback({result: msg.result || [], error: err});
}
stop() {
if (this.stopRequested) {
throw new Error('close already requested');
}
if (!this.conn || this.conn.readyState === 'closed') {
throw new Error('connection already closed');
}
this.stopRequested = true;
if (this.onClose) this.onClose();
}
call(method: string, ...params: Vals): Promise<Vals> {
return new Promise((resolve, reject) => {
const id = this.nextId++;
@ -200,6 +189,17 @@ abstract class IPCCommon {
});
}
stop() {
if (this.stopRequested) {
throw new Error('close already requested');
}
if (!this.conn || this.conn.readyState === 'closed') {
throw new Error('connection already closed');
}
this.stopRequested = true;
if (this.onClose) this.onClose();
}
protected raiseErr(err: Error): void {
this.errorQueue.put(err);
}