def client.streams.go
bend-kit-http2@0.4.0.0 · http2.bend:670
import bend-kit-http2@0.4.0.0/http2.bend as Http2
import Base
670def client.streams.go(xs: List<&1, Stream>, found: Bool, previous: Maybe<&1, Stream>,
671 +target: U32, k: Stream -> List<&1, Stream> -> Reply) -> Reply:
672 match xs:
673 case Nil{}:
674 match found:
675 case False{}:
676 client.fail(5, False{}, target)
677 case True{}:
678 match previous:
679 case None{}:
680 client.fail(1, True{}, 0)
681 case Some{s}:
682 k(s, Nil{})
683 case Con{s, rest}:
684 Stream{+id, send_window, recv_window, local_end, remote_end, head, headers, partial, body, outgoing} = s
685 match found:
686 case True{}:
687 match previous:
688 case None{}:
689 client.fail(1, True{}, 0)
690 case Some{matched}:
691 k(matched, Con{Stream{id, send_window, recv_window, local_end, remote_end,
692 head, headers, partial, body, outgoing}, rest})
693 case False{}:
694 client.streams.prefix(previous,
695 client.streams.go(rest, U32.is_eq(id, target),
696 Some{Stream{id, send_window, recv_window, local_end, remote_end, head, headers, partial, body, outgoing}},
697 target, k))