Use flow control to avoid being spammed by fast talkers
This commit is contained in:
parent
55f01cea3f
commit
3030d1959e
|
@ -14,9 +14,10 @@
|
|||
(assert (tcp-accepted id))
|
||||
(assert (server-poa id))
|
||||
(stop-when (retracted (server-poa-ready id)))
|
||||
(on-start (issue-unbounded-credit! tcp-in id))
|
||||
(on-start (issue-credit! #:amount 32768 tcp-in id))
|
||||
(define accumulate! (packet-accumulator (lambda (p) (send! (message-poa->server id p)))))
|
||||
(on (message (tcp-in id $bs))
|
||||
(issue-credit! #:amount (bytes-length bs) tcp-in id)
|
||||
(accumulate! bs))
|
||||
(on (message (message-server->poa id $p))
|
||||
(send! (tcp-out id (encode p)))
|
||||
|
|
Loading…
Reference in New Issue