def server.serve_forever_with

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

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

459# listen and serve with an IO handler and a context value until the process
460# is stopped, at most `max` connections at once (0: no limit)
461@unsafe def server.serve_forever_with(~C: Data,
462  ~handle: C -> Req -> IO(Answer), +ctx: C, host: String, port: U32, +max: U32)
463  -> IO(Unit):
464  do IO<Unit>:
465    lst : Listener <- server.listen(host, port)
466    +slots : Chan(Unit) <- server.slots(max)
467    +done : Chan(Unit) <- Chan.new(Unit, 1)
468    server.forever.go(~C, handle, ctx, slots, Bool.not(U32.is_eq(max, 0)), done,
469      lst)

Uses (15)

Used by (2)