async fn classify_uni_stream(
recv: RecvStream,
draft: DraftVersion,
) -> (PeekedRecv, UniStreamKind)Expand description
Read a unidirectional stream’s type varint and say what the stream is.
The bytes it reads are handed back inside the returned PeekedRecv, so
the pipe that takes the stream sees them exactly as if they had never
been taken off it. Nothing is stripped: on these drafts the type varint
is the SETUP message’s type field.
§It reads, so it can block — which is why it runs per stream
A stream that is opened and then stays silent produces no varint, and this waits for one. That is why the call site is inside the per-stream task rather than in the accept loop: a peer that opens a stream and writes nothing must not stop the session accepting the next one.
§A stream that ends or fails before its type arrives is data
Not because it is one, but because there is nothing left to decide with
and the pipe is the honest place to surface the end: it sees the same EOF
or the same reset one read later and reports it the way it reports every
other one. Answering Control on no evidence would hand the session’s
injection channel to a stream that carried nothing.