From 922e4bcca6655d4ad378461503e61f57d715cae2 Mon Sep 17 00:00:00 2001 From: David Florness Date: Thu, 9 Apr 2020 16:52:38 -0600 Subject: [PATCH] Add command to list peers who need to commit --- bulletin.rkt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bulletin.rkt b/bulletin.rkt index d764cb2..1003f99 100644 --- a/bulletin.rkt +++ b/bulletin.rkt @@ -293,5 +293,15 @@ (hash-remove! _peers token))) (displayln "close the election first"))] ['state (displayln (symbol->string state))] + ['waiting + (displayln + (set-map + (for/set ([p (hash-values _peers)] + #:when (not (hash-has-key? _commits (hash-ref p 'input)))) + (hash-ref p 'input)) + (λ (input) + (for/first ([(k v) _peers] + #:when (equal? (hash-ref v 'input) input)) + (hash-ref v 'username)))))] [else (displayln "unknown command")]) (loop))))))) -- 2.38.4