diff --git a/src/actor.ts b/src/actor.ts index 2cc484b..2a4ef53 100644 --- a/src/actor.ts +++ b/src/actor.ts @@ -108,15 +108,15 @@ export class Actor { readonly id = nextActorId++; readonly outbound: Map; exitReason: ExitReason = null; - // readonly exitHooks: Array = []; + readonly exitHooks: Array = []; constructor(initialAssertions = new Map()) { this.outbound = initialAssertions; } - // atExit(a: LocalAction): void { - // this.exitHooks.push(a); - // } + atExit(a: LocalAction): void { + this.exitHooks.push(a); + } terminateWith(t: Turn, reason: Exclude) { if (this.exitReason !== null) return; @@ -124,7 +124,7 @@ export class Actor { if (!this.exitReason.ok) { console.error(`Actor ${this.id} crashed:`, this.exitReason.err); } - // this.exitHooks.forEach(hook => hook(t)); + this.exitHooks.forEach(hook => hook(t)); queueTask(() => t.freshen(t => this.outbound.forEach((peer, h) => t._retract(peer, h))));