def Stream.opened

bend-kube-runtime@0.2.0.0 · src/stream.bend:128

import bend-kube-runtime@0.2.0.0/src/stream.bend as Stream
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
import bend-kube-runtime@0.2.0.0/src/client.bend as Cl

128def Stream.opened(~S: Type, ~on: S -> List<&2, U32> -> IO(S), st: S,
129  t: Result<&1, &1, U32 & String, N.Tls>, +ms: U32) -> IO(Res(S)):
130  match t:
131    case Done{N.Tls{s}}:
132      IO.bind(Socket & Res(S), Res(S),
133        Stream.loop(~S, ~on, 4294967295n,
134          SChk{s, H.Http.resp.init(), Nil{}, None{}, False{}, False{}, True{}, False{}, 0}, st,
135          Nil{}, ms), p => Stream.close(~S, p))
136    case Fail{(c, m)}:
137      IO.pure(Res(S), Fail{Cl.KNet{c, m}})

Uses (19)

Used by (1)