From 9f20b36bfc3a910b5c2b679c37cad4f977b8ed4d Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 3 May 2019 11:20:12 +0100 Subject: [PATCH] Only remove an entry from specs when no holders remain --- imperative/broker/federation2.rkt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/imperative/broker/federation2.rkt b/imperative/broker/federation2.rkt index f00f12c..6452a19 100644 --- a/imperative/broker/federation2.rkt +++ b/imperative/broker/federation2.rkt @@ -93,10 +93,10 @@ localid connid (lambda (sub) (define new-holders (hash-remove (subscription-holders sub) connid)) - (specs (hash-remove (specs) (subscription-spec sub))) - (subs (if (hash-empty? new-holders) - (hash-remove (subs) localid) - (hash-set (subs) localid (struct-copy subscription sub + (if (hash-empty? new-holders) + (begin (specs (hash-remove (specs) (subscription-spec sub))) + (subs (hash-remove (subs) localid))) + (subs (hash-set (subs) localid (struct-copy subscription sub [holders new-holders])))) ;; The messages we send depend on (hash-count new-holders):