From a5cdd5b12ff413f08965229d8b1b283f362c358a Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 21 Nov 2016 10:55:06 +1300 Subject: [PATCH] Warn when too many canonical-host records exist --- racketmq/hub.rkt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/racketmq/hub.rkt b/racketmq/hub.rkt index 3d06127..ee59e83 100644 --- a/racketmq/hub.rkt +++ b/racketmq/hub.rkt @@ -24,10 +24,19 @@ (spawn-configuration filename)]) (actor #:name 'main + (during (config (list 'canonical-host $h $p)) (assert (canonical-local-host h p)) (assert (local-host h p))) + + (define/query-set canonical-local-hosts ($ c (canonical-local-host _ _)) c) + (stop-when (rising-edge (> (set-count (canonical-local-hosts)) 1)) + (log-error "Too many canonical-host records in configuration.")) + ;; TODO: Make the too-many-canonical-host-records situation recoverable. + ;; TODO: And/or, make the whole application quit when it gets into a bad state. + (during (config (list 'accepted-host $h $p)) (assert (local-host h p))) + (during (local-host $host-name $port) (assert (vh host-name port))))