1 files changed, 10 insertions(+), 0 deletions(-)
M bulletin.rkt
M bulletin.rkt => bulletin.rkt +10 -0
@@ 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)))))))