Wait for credit before closing the connection.

This commit is contained in:
Tony Garnock-Jones 2012-07-11 09:40:47 -04:00
parent 07922cec64
commit 913653bba9
1 changed files with 5 additions and 3 deletions

View File

@ -10,11 +10,13 @@
(define ((connection-handler local-addr remote-addr) self-pid)
(transition 'no-state
(role 'date-sender (topic-publisher (tcp-channel local-addr remote-addr (wild)))
#:state state)
#:state state
[(tcp-channel _ _ (tcp-credit _))
(transition state
(kill))])
(send-message (tcp-channel local-addr remote-addr
(string->bytes/utf-8
(format "~a\n" (current-inexact-milliseconds)))))
(kill)))
(format "~a\n" (current-inexact-milliseconds)))))))
(define (listener local-addr)
(transition 'no-state