Warn when too many canonical-host records exist

This commit is contained in:
Tony Garnock-Jones 2016-11-21 10:55:06 +13:00
parent 1c7b80606d
commit a5cdd5b12f
1 changed files with 9 additions and 0 deletions

View File

@ -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))))