def Serve.loop

bend-kube-runtime@0.2.0.0 · src/serve.bend:216

import bend-kube-runtime@0.2.0.0/src/serve.bend as Serve
import Base
import bend-kube-runtime@0.2.0.0/src/runtime.bend as R

216# Accepts forever (fuel permitting), serving each connection on its own.
217def Serve.loop(fuel: Nat, ev: AEv, +status: Chan(R.SMsg)) -> IO(Unit):
218  match fuel ev:
219    case 0n AGot{l, r}:
220      Listener.close(l)
221    case 1n+f AGot{l, r}:
222      IO.bind(Unit, Unit, Serve.accepted(r, status),
223        u => IO.bind(Listener & Serve.Res(Socket), Unit, TCP.accept(l),
224          p => Serve.loop(f, AEv.got(p), status)))

Uses (15)

Used by (1)