def stream.conn
bend-kit-http@0.38.5.0 · http.bend:4960
import bend-kit-http@0.38.5.0/http.bend as Http
import Base
import bend-kit-wire@0.4.8.0/wire.bend as Wire
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
4960
4961def 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>):
4962 match r:
4963 case Fail{e}:
4964 IO.pure(Bool & Result<&1, &1, Err, Stream>, (False{}, Fail{e}))
4965 case Done{c}:
4966 match c:
4967 case Conn{+tls, s}:
4968 do IO<Bool & Result<&1, &1, Err, Stream>>:
4969 sent : Socket & Result<&1, &1, U32 & String, Unit> <- io.send.bytes(tls, s, wire)
4970 stream.sent(tls, ms, head, back, sent)
4971 case ConnH2{s, client}:
4972 do IO<Bool & Result<&1, &1, Err, Stream>>:
4973 Wire.tls.close(s)
4974 return (False{}, Fail{ErrBad{}})