From 913653bba96b9b31c10439152cfa232f7da77209 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 11 Jul 2012 09:40:47 -0400 Subject: [PATCH] Wait for credit before closing the connection. --- os2-tcp-test-date-service.rkt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/os2-tcp-test-date-service.rkt b/os2-tcp-test-date-service.rkt index abd4475..d78355e 100644 --- a/os2-tcp-test-date-service.rkt +++ b/os2-tcp-test-date-service.rkt @@ -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