From 148aae4afbbbfa1a0845746294acb1385deda9b6 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 25 Apr 2016 12:51:09 -0500 Subject: [PATCH] actors: Fix resuming continuation when waiting on message. Pattern matching was wrong. Also added an error check. * 8sync/systems/actors.scm (hive-process-message): Fix pattern match. Add error check that we're resuming to the correct actor. --- 8sync/systems/actors.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/8sync/systems/actors.scm b/8sync/systems/actors.scm index ce55597..f9b9047 100644 --- a/8sync/systems/actors.scm +++ b/8sync/systems/actors.scm @@ -464,7 +464,14 @@ more compact following syntax: (define (resume-waiting-coroutine) (match (hash-remove! (hive-waiting-coroutines hive) (message-in-reply-to message)) - ((_ . kont) + ((_ . (resume-actor-id . kont)) + (if (not (equal? (message-to message) + resume-actor-id)) + (throw 'resuming-to-wrong-actor + "Attempted to resume a coroutine to the wrong actor!" + #:expected-actor-id (message-to message) + #:got-actor-id resume-actor-id + #:message message)) (kont message)) (#f (throw 'no-waiting-coroutine "message in-reply-to tries to resume nonexistent coroutine" -- 2.31.1