cloudflare / cloudflare/quiche
Graceful shutdown: Await all data on the stream being consumed
- Dominant language
- Rust
- Stars
- 11.8k
- Forks
- 1.1k
- Avg merge
- 21h 9m
- Merged PRs (30d)
- 6
Description
According to the HTTP/3 spec and also WebTransport:
> Once all accepted requests and pushes have been processed, the endpoint can permit the connection to become idle, or it MAY initiate an immediate closure of the connection.
~ https://www.rfc-editor.org/rfc/rfc9114.html#name-connection-shutdown
> If the endpoint
were to do both of those simultaneously, the peer could potentially
receive the CONNECTION_CLOSE before receiving the
CLOSE_WEBTRANSPORT_SESSION, thus never receiving the application
error data contained in the latter. To avoid this, the endpoint
SHOULD wait until all of the data on the CONNECT stream is
acknowledged before sending the CONNECTION_CLOSE
~ https://datatracker.ietf.org/doc/draft-ietf-webtrans-http3/
How is this achievable with quiche?
I assume that the only possibility is to *poll* [stream_capacity()](https://docs.quic.tech/quiche/struct.Connection.html#method.stream_capacity) on every single open stream each time some data arrives from the peer, comparing against the bidirectional or unidirectional send buffer sizes? But not really sure what to compare the returned value against - what is the capacity if everything has been acknowleged? Or is stream_capacity() the max capacity and not related to the acknowledged bytes? I'm not sure from documentation.
Apart from that I cannot find a possibility to await "has all data been acknowledged?" on one or all streams of a connection.
Is this missing functionality or am I just overlooking some API?
Contributor guide
Assessment
This issue has not been assessed yet.