Http.server.accept.loop: def of bend-kit-http@0.38.2.0 Import: import bend-kit-http@0.38.2.0/http.bend as Http Lines 6440-6469 of bend-kit-http@0.38.2.0/http.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-http@0.38.2.0/http.bend&start_line=6440&end_line=6469 import Base import bend-kit-http@0.38.2.0/admission.bend as Admission import bend-kit-wire@0.4.7.0/wire.bend as Wire def server.accept.loop(~C: Data, ~operation: C -> Limits -> Chan(Admission.Command) -> Socket -> IO(Unit), step: AcceptStep) -> IO(Server & Result<&1, &1, U32 & String, Chan(Unit)>): match step: case AcceptChecking{server}: Server{listener, context, config, +inbox, drained} = server do IO & Result<&1, &1, U32 & String, Chan(Unit)>>: running : Bool <- Admission.running(inbox) server.accept.loop(~C, ~operation, AcceptAllowed{running, Server{listener, context, config, inbox, drained}}) case AcceptAllowed{running, server}: match running: case False{}: IO.pure(Server & Result<&1, &1, U32 & String, Chan(Unit)>, (server, Fail{(0, "server stopped")})) case True{}: Server{listener, context, config, inbox, drained} = server do IO & Result<&1, &1, U32 & String, Chan(Unit)>>: result : Listener & Result<&1, &1, U32 & String, Socket> <- Wire.accept.deadline(listener, 50) accepted : Server & Result<&1, &1, U32 & String, Chan(Unit)> <- server.accepted(~C, ~operation, context, config, inbox, drained, result) server.accept.loop(~C, ~operation, AcceptReceived{accepted}) case AcceptReceived{accepted}: (server, result) = accepted match result: case Fail{(+code, message)}: server.accept.loop(~C, ~operation, AcceptFailed{err.late(code), server, (code, message)}) case Done{finished}: IO.pure(Server & Result<&1, &1, U32 & String, Chan(Unit)>, (server, Done{finished})) case AcceptFailed{retry, server, error}: match retry: case True{}: server.accept.loop(~C, ~operation, AcceptChecking{server}) case False{}: IO.pure(Server & Result<&1, &1, U32 & String, Chan(Unit)>, (server, Fail{error})) Uses (21): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Chan https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.pure https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Listener https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Socket https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=bend-kit-http@0.38.2.0/admission.bend&name=Command https://jend.leeeet.dev/definition.txt?path=bend-kit-http@0.38.2.0/admission.bend&name=running https://jend.leeeet.dev/definition.txt?path=bend-kit-http@0.38.2.0/http.bend&name=AcceptStep https://jend.leeeet.dev/definition.txt?path=bend-kit-http@0.38.2.0/http.bend&name=Limits https://jend.leeeet.dev/definition.txt?path=bend-kit-http@0.38.2.0/http.bend&name=Server https://jend.leeeet.dev/definition.txt?path=bend-kit-http@0.38.2.0/http.bend&name=err.late https://jend.leeeet.dev/definition.txt?path=bend-kit-http@0.38.2.0/http.bend&name=server.accepted https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=accept.deadline