def stream.idle
bend-kit-http@0.38.2.0 · http.bend:5002
import bend-kit-http@0.38.2.0/http.bend as Http
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
5002
5003def stream.idle(p: Pool, +ms: U32, +head: Bool, +idem: Bool, +key: String, route: Route,
5004 r: Bytes.Bytes & Bytes.Bytes, c: Conn) -> IO(Pool & Result<&1, &1, Err, Stream>):
5005 (wire, spare) = r
5006 match c:
5007 case Conn{tls, s}:
5008 do IO<Pool & Result<&1, &1, Err, Stream>>:
5009 x : Bool & Result<&1, &1, Err, Stream> <- stream.conn(Done{Conn{tls, s}}, ms, head, Some{key}, wire)
5010 stream.reused(p, ms, head, idem, key, route, spare, x)
5011 case ConnH2{s, client}:
5012 do IO<Pool & Result<&1, &1, Err, Stream>>:
5013 next : Pool <- pool.give(p, key, ConnH2{s, client})
5014 got : Result<&1, &1, Err, Stream> <- stream.fresh(ms, head, Some{key}, route, spare)
5015 return (next, got)