def wire.loop.un
emerging-ezhttp@0.21.0.0 · src/wire.bend:124
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
124
125def wire.loop.un(+secure: Bool, +host: String, +port: U32, +ms: U32,
126 +h: Http.Hear, acc: Bytes.Bytes,
127 r: Socket & Result<&1, &1, U32 & String, U32 & Array<U32>>,
128 more: Socket -> Http.Hear -> Bytes.Bytes -> IO(Answer)) -> IO(Answer):
129 (s, res) = r
130 match res:
131 case Fail{(n, why)}:
132 wire.failed(secure, s,
133 Spec.wire.fail(Spec.Receive{}, host, port, ms, n, why))
134 case Done{(+len, buf)}:
135 wire.loop.judge(secure, s, h, Bytes.Bytes{len, buf}, acc,
136 Spec.wire.read.count(h, U32.to_nat(len)), more)