Only remove an entry from specs when no holders remain

This commit is contained in:
Tony Garnock-Jones 2019-05-03 11:20:12 +01:00
parent 736c9de3dc
commit ed7cf375ad
1 changed files with 4 additions and 4 deletions

View File

@ -93,10 +93,10 @@
localid connid localid connid
(lambda (sub) (lambda (sub)
(define new-holders (hash-remove (subscription-holders sub) connid)) (define new-holders (hash-remove (subscription-holders sub) connid))
(specs (hash-remove (specs) (subscription-spec sub))) (if (hash-empty? new-holders)
(subs (if (hash-empty? new-holders) (begin (specs (hash-remove (specs) (subscription-spec sub)))
(hash-remove (subs) localid) (subs (hash-remove (subs) localid)))
(hash-set (subs) localid (struct-copy subscription sub (subs (hash-set (subs) localid (struct-copy subscription sub
[holders new-holders])))) [holders new-holders]))))
;; The messages we send depend on (hash-count new-holders): ;; The messages we send depend on (hash-count new-holders):