def stream.conn
bend-kit-http@0.38.2.0 · http.bend:4956
import bend-kit-http@0.38.2.0/http.bend as Http
import Base
import bend-kit-wire@0.4.7.0/wire.bend as Wire
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
4956
4957def stream.conn(r: Result<&1, &1, Err, Conn>, +ms: U32, +head: Bool, back: Maybe<&2, String>, wire: Bytes.Bytes) -> IO(Bool & Result<&1, &1, Err, Stream>):
4958 match r:
4959 case Fail{e}:
4960 IO.pure(Bool & Result<&1, &1, Err, Stream>, (False{}, Fail{e}))
4961 case Done{c}:
4962 match c:
4963 case Conn{+tls, s}:
4964 do IO<Bool & Result<&1, &1, Err, Stream>>:
4965 sent : Socket & Result<&1, &1, U32 & String, Unit> <- io.send.bytes(tls, s, wire)
4966 stream.sent(tls, ms, head, back, sent)
4967 case ConnH2{s, client}:
4968 do IO<Bool & Result<&1, &1, Err, Stream>>:
4969 Wire.tls.close(s)
4970 return (False{}, Fail{ErrBad{}})