tcp-connection-peer

This commit is contained in:
Tony Garnock-Jones 2019-01-28 01:14:58 +00:00
parent 23580010bb
commit e72e22f250
1 changed files with 3 additions and 0 deletions

View File

@ -15,6 +15,7 @@
;; b) no facility for separate shutdown of inbound/outbound streams
(provide (struct-out tcp-connection)
(struct-out tcp-connection-peer)
(struct-out tcp-accepted)
(struct-out tcp-out)
(struct-out tcp-in)
@ -39,6 +40,7 @@
;; Protocol messages
(assertion-struct tcp-connection (id spec))
(assertion-struct tcp-connection-peer (id addr))
(assertion-struct tcp-accepted (id))
(message-struct tcp-out (id bytes))
(message-struct tcp-in (id bytes))
@ -129,6 +131,7 @@
(define id (seal (list port remote-addr)))
(spawn #:name (list 'drivers/tcp 'inbound id)
(assert (tcp-connection id server-addr))
(assert (tcp-connection-peer id remote-addr))
(define unblock! (run-connection id cin cout))
(on (asserted (tcp-accepted id)) (unblock!))
(stop-when (retracted (tcp-accepted id))))))