def wire.loop
emerging-ezhttp@0.21.0.0 · src/wire.bend:138
import emerging-ezhttp@0.21.0.0/src/wire.bend as Wire
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
import emerging-ezhttp@0.21.0.0/src/wirespec.bend as Spec
import emerging-ezhttp@0.21.0.0/src/http.bend as Http
138
139
140def wire.loop(fuel: Nat, +secure: Bool, s: Socket, +host: String, +port: U32,
141 +ms: U32, h: Http.Hear, acc: Bytes.Bytes) -> IO(Answer):
142 match fuel:
143 case 0n:
144 wire.failed(secure, s, Spec.wire.spent())
145 case 1n+p:
146 IO.bind(Socket & Result<&1, &1, U32 & String, U32 & Array<U32>>, Answer,
147 wire.recv(secure, s, ms),
148 r => wire.loop.un(secure, host, port, ms, h, acc, r,
149 s2 => h2 => a2 => wire.loop(p, secure, s2, host, port, ms, h2, a2)))