def client.flush.go

bend-kit-http2@0.4.0.0 · http2.bend:714

import bend-kit-http2@0.4.0.0/http2.bend as Http2
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

714def client.flush.go(xs: List<&1, Stream>, +connection: U32, +max: U32) -> Maybe<&1, Flushed>:
715  match xs:
716    case Nil{}:
717      Some{Flushed{Nil{}, connection, Nil{}}}
718    case Con{Stream{+id, +stream_window, recv_window, local_end, remote_end,
719        head, headers, partial, body, outgoing}, rest}:
720      match outgoing:
721        case Bytes.Bytes{0, buf}:
722          Maybe.map(&1, Flushed, Flushed, tail =>
723            client.flush.prepend(Stream{id, stream_window, recv_window, local_end, remote_end,
724              head, headers, partial, body, Bytes.Bytes{0, buf}}, Nil{}, tail),
725            client.flush.go(rest, connection, max))
726        case Bytes.Bytes{+len, buf}:
727          Maybe.bind(&1, BodySent, Flushed,
728            client.data(id, max, connection, stream_window, Bytes.Bytes{len, buf}), sent =>
729              client.with_sent(Maybe<&1, Flushed>, sent, remaining => ended => next_stream => next_connection => packets =>
730                Maybe.map(&1, Flushed, Flushed, tail =>
731                  client.flush.prepend(Stream{id, next_stream, recv_window, ended, remote_end,
732                    head, headers, partial, body, remaining}, packets, tail),
733                  client.flush.go(rest, next_connection, max))))

Uses (15)

Used by (2)