This commit is contained in:
Tony Garnock-Jones 2021-02-23 11:09:41 +01:00
parent bea357d516
commit f8e6fc4ab6
1 changed files with 2 additions and 6 deletions

View File

@ -40,19 +40,15 @@ export class Actor {
this.outbound = initialAssertions;
}
get alive(): boolean {
return this.exitReason === null;
}
terminateWith(t: Turn, reason: Exclude<ExitReason, null>) {
if (!this.alive) return;
if (this.exitReason !== null) return;
this.exitReason = reason;
this.outbound.forEach((peer, h) => t._retract(peer, h));
}
execute(proc: () => void): void {
queueMicrotask(() => {
if (!this.alive) return;
if (this.exitReason !== null) return;
try {
proc();
} catch (err) {