Replace one instance of yield with a use of wait-for.
This commit is contained in:
parent
3fe3bee397
commit
f2046db35d
|
@ -133,6 +133,14 @@
|
||||||
(flush-output)
|
(flush-output)
|
||||||
state]))
|
state]))
|
||||||
|
|
||||||
|
(define-syntax-rule (wait-for topic-of-interest #:state state action ...)
|
||||||
|
(let ((role-name (gensym 'wait-for)))
|
||||||
|
(role role-name topic-of-interest
|
||||||
|
#:state state
|
||||||
|
#:on-presence (sequence-actions state
|
||||||
|
(delete-role role-name)
|
||||||
|
action ...))))
|
||||||
|
|
||||||
(define (session-vm local-addr remote-addr)
|
(define (session-vm local-addr remote-addr)
|
||||||
(define local-identification #"SSH-2.0-RacketSSH_0.0")
|
(define local-identification #"SSH-2.0-RacketSSH_0.0")
|
||||||
|
|
||||||
|
@ -160,12 +168,13 @@
|
||||||
(spawn (ssh-writer local-addr remote-addr)
|
(spawn (ssh-writer local-addr remote-addr)
|
||||||
#:exit-signal? #t
|
#:exit-signal? #t
|
||||||
#:debug-name 'ssh-writer)
|
#:debug-name 'ssh-writer)
|
||||||
;; (Wait for a cycle to let the reader and writer get
|
;; Wait for the reader and writer get started, then tell
|
||||||
;; started, then tell the reader we are ready for a single
|
;; the reader we are ready for a single packet and spawn
|
||||||
;; packet and spawn the session manager.)
|
;; the session manager.
|
||||||
;; TODO: try using presence instead of the yield.
|
(wait-for (topic-subscriber (inbound-packet (wild) (wild) (wild) (wild)) #:monitor? #t)
|
||||||
(yield #:state state
|
#:state state
|
||||||
(transition state
|
(wait-for (topic-publisher (outbound-packet (wild)) #:monitor? #t)
|
||||||
|
#:state state
|
||||||
(send-message (inbound-credit 1))
|
(send-message (inbound-credit 1))
|
||||||
(spawn (ssh-session local-identification
|
(spawn (ssh-session local-identification
|
||||||
remote-identification
|
remote-identification
|
||||||
|
|
Loading…
Reference in New Issue