def server.serve_io_with

emerging-ezhttp@0.21.0.0 · src/server.bend:426

import emerging-ezhttp@0.21.0.0/src/server.bend as Server
import Base

426# listen and serve up to `limit` connections, each on its own fork, at most
427# `max` at once (0: no limit), with a context value for the handler; returns
428# once every fork is done (SPEC.md HTTP-TRUST-2)
429def server.serve_io_with(~C: Data, ~handle: C -> Req -> IO(Answer), +ctx: C,
430  host: String, port: U32, limit: U32, +max: U32) -> IO(Unit):
431  do IO<Unit>:
432    lst : Listener <- server.listen(host, port)
433    +slots : Chan(Unit) <- server.slots(max)
434    +done : Chan(Unit) <- Chan.new(Unit, 1024)
435    server.loop.go(~C, handle, ctx, U32.to_nat(limit), server.idles(), 0n, slots,
436      Bool.not(U32.is_eq(max, 0)), done, lst)

Uses (17)

Used by (3)