No longer need inbound flag on tcp-data, since streams are directional now

This commit is contained in:
Tony Garnock-Jones 2012-03-13 15:08:32 -04:00
parent 23a8237a9a
commit ffe06a65a8
2 changed files with 7 additions and 7 deletions

View File

@ -20,7 +20,7 @@
(struct tcp-option (name value) #:prefab)
(struct tcp-credit (amount) #:prefab)
(struct tcp-data (inbound? chunk) #:prefab)
(struct tcp-data (chunk) #:prefab)
(struct tcp-eof () #:prefab)
;; The address of a TCP endpoint.
@ -100,7 +100,7 @@
(loop 0 mode)]
[else
;;(write `(relaying line ,v from ,name)) (newline)
(send handle say (topic-publisher name) (tcp-data #t v))
(send handle say (topic-publisher name) (tcp-data v))
(loop (- credit 1) mode)])))]
['bytes (handle-evt (read-bytes-evt credit i)
(lambda (v)
@ -110,7 +110,7 @@
(loop 0 mode)]
[else
;;(write `(relaying bytes ,v from ,name)) (newline)
(send handle say (topic-publisher name) (tcp-data #t v))
(send handle say (topic-publisher name) (tcp-data v))
(loop (- credit (bytes-length v)) mode)])))])
never-evt))))
@ -126,7 +126,7 @@
(tcp-abandon-port o)]
[(says (topic 'publisher (== name) _) (tcp-option 'mode new-mode))
(loop new-mode)]
[(says (topic 'publisher (== name) _) (tcp-data #f v))
[(says (topic 'publisher (== name) _) (tcp-data v))
;;(write `(writing ,v to ,name)) (newline)
(define credit-amount
(match mode

View File

@ -18,7 +18,7 @@
(send h assert! (topic-subscriber inbound-stream))
(send h assert! (topic-publisher groupchat))
(send h assert! (topic-subscriber groupchat))
(define (send-text s) (send h say (topic-publisher outbound-stream) (tcp-data #f s)))
(define (send-text s) (send h say (topic-publisher outbound-stream) (tcp-data s)))
(define (issue-credit) (send h say (topic-subscriber inbound-stream) (tcp-credit 1)))
(issue-credit)
(let loop ((prompt? #t))
@ -26,12 +26,12 @@
(match (send h listen)
[(says (topic 'publisher (== inbound-stream) _) (tcp-eof))
(send-text "OK, bye\n")]
[(says (topic 'publisher (== inbound-stream) _) (tcp-data #t "quit"))
[(says (topic 'publisher (== inbound-stream) _) (tcp-data "quit"))
(issue-credit)
(quit-proc)
(send-text "OK, will quit accepting\n")
(loop #t)]
[(says (topic 'publisher (== inbound-stream) _) (tcp-data #t what))
[(says (topic 'publisher (== inbound-stream) _) (tcp-data what))
(write `(someone said ,what))
(newline)
(issue-credit)