Client.Conn.read: def of bend-kube-runtime@0.2.0.0 Import: import bend-kube-runtime@0.2.0.0/src/client.bend as Client Lines 299-321 of bend-kube-runtime@0.2.0.0/src/client.bend: https://jend.leeeet.dev/read.txt?path=bend-kube-runtime@0.2.0.0/src/client.bend&start_line=299&end_line=321 import Base import bend-kube-runtime@0.2.0.0/src/http.bend as H import bend-kube-runtime@0.2.0.0/src/net.bend as N # Reads until the response is whole, the stream ends, or fuel runs out; # ms bounds each recv. Answers the socket and the decoder. def Conn.read(fuel: Nat, ev: ReadEv, +resp: H.Resp, +ms: U32) -> IO(Socket & H.Resp): match fuel ev: case 0n RGot{s, r}: IO.pure(Socket & H.Resp, (s, Http.fail("response too long"))) case 0n RChk{s, d, e, b}: IO.pure(Socket & H.Resp, (s, Http.fail("response too long"))) case 1n+f RGot{s, Done{+bs}}: +next = H.Http.feed(bs, resp) Conn.read(f, RChk{s, H.Http.is_done(next), List.is_empty(&2, U32, bs), Http.has_err(next)}, next, ms) case 1n+f RGot{s, Fail{(c, m)}}: IO.pure(Socket & H.Resp, (s, Http.lost(resp, "recv: " ++ m))) case 1n+f RChk{s, True{}, e, b}: IO.pure(Socket & H.Resp, (s, resp)) case 1n+f RChk{s, False{}, True{}, b}: IO.pure(Socket & H.Resp, (s, H.Http.eof(resp))) case 1n+f RChk{s, False{}, False{}, True{}}: IO.pure(Socket & H.Resp, (s, resp)) case 1n+f RChk{s, False{}, False{}, False{}}: IO.bind(Socket & Res(List<&2, U32>), Socket & H.Resp, N.Tls.recv(s, 65536, ms), p => Conn.read(f, ReadEv.got(p), resp, ms)) Uses (24): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool 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=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.is_empty https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat 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.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/client.bend&name=Http.fail https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/client.bend&name=Http.has_err https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/client.bend&name=Http.lost https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/client.bend&name=ReadEv https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/client.bend&name=ReadEv.got https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/client.bend&name=Res https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/http.bend&name=Http.eof https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/http.bend&name=Http.feed https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/http.bend&name=Http.is_done https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/http.bend&name=Resp https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/net.bend&name=Tls.recv