Add documentation links and references to some of the main parts of the API so
that relevant structs, enums and methods can be navigated to more quickly. This
reduces the need for the search bar and thus makes it easier to find related
content wherever it is mentioned.
Since remote IP addresses can change, it's useful to have an independent
ID for a connection that is always the same.
quinn_proto::ConnectionHandle provides a mechanism for this, but
quinn::Connection has an Arc internally whose internal pointer can be
used as a unique identifier since acquiring the ConnectionHandle would
require locking a mutex.
If nothing else, this should make it easier to track goings-on in
streams in client code since they'll be able to easily distinguish
between streams via StreamId::index().
Defers responsibility for closing send streams to the
application. This simplifies the stream lifecycle, because we no
longer need to track whether a stop was observed in a write error and
potentially free stream state after returning one. Fixes a stream
state leak for applications which don't necessarily observe write
errors.
Improves consistency with other stream interfaces. H3 logic was
updated to ignore errors to preserve existing behavior, but future
work might want to insert some unwraps there if static correctness
guarantees are available.
Previously, flow control credit would not be issued for data received
on stopped streams unless the application continued reading them
indefinitely. This produced a flow control leak in the high level API,
causing applications which dropped streams with unread data to
eventually grind to a halt.
Discarding data immediately should also improve performance when data
is being received on stopped streams, and allows us to discard stream
state earlier.
Obtaining a fresh `now` on every iteration ensures that if tokio
checks timer completion using a later time than we do, we'll
eventually catch up and deem it expired as well rather than infinitely
restarting it.
If the peer acknowledges the stream FIN and the the Finish future
isn't polled between then and the connection becoming
closed (guaranteed to be the case if the ACK and the CONNECTION_CLOSE
are in the same packet, which is common) then the Finish future would
yield an error even though the stream is guaranteed to have been
finished.
The default client config setup contains low-level rustls code that is
better off in quinn-proto. This also makes the OS store roots and
certificate transparency easily available to quinn-proto users, and
makes it easy to use them by using Cargo-level features.
This is the second time we flip-flop on this. Previously in
4fd486862b (#351) we moved these types from
quinn into quinn-proto so that they could be used as part of the low-level
configuration API.
Then in 9522b44600 (#511) we moved them back
into quinn after some discussion, making the point that the configuration
API at the quinn-proto was not in a great place.
Here, we keep the existing quinn-proto configuration API and merely offer
an abstracted API relying on the wrapper types for use in quinn internals.