-
Notifications
You must be signed in to change notification settings - Fork 924
tokio-quiche: Enable active connection migration for clients of tq's QUIC server #2289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1cef63e to
34e4052
Compare
|
CI failures are due to missing apt packages, Took some time to investigate, it's because we don't call |
34e4052 to
a57fa83
Compare
This ID is redundant as we can identify a connection by its (possibly multiple) QUIC connection IDs. There is no place where we actually use the internal ID.
We can support socket-specific CID generators by moving the trait object from the top-level entrypoints to `QuicListener`, which exists separately for each socket. This allows the implementor full flexibility in terms of what properties to consider when generating CIDs for a given socket. To avoid a type parameter in `QuicListener`, we require the user to pass us an `Arc<dyn ConnectionIdGenerator>` (which is the internal representation we want to use anyway.) This also allows users to share a generator across all of their sockets.
We aim to always provide as many CIDs to the peer as the local+remote transport parameters allow. At the same time, retired connection IDs are unmapped to keep the ConnectionMap compact. To produce new connection IDs, we wire up the socket's `Arc<dyn ConnectionIdGenerator>` all the way to the IoWorker parameters.
a57fa83 to
8f4cfe5
Compare
Now that the tokio-quiche work loop issues extra connection IDs, we can properly support active connection migration. This is not a feature available to tokio-quiche clients today, but other QUIC clients talking to tokio-quiche servers can take advantage of it.
8f4cfe5 to
3841db7
Compare
| client_config.set_initial_max_streams_bidi(10); | ||
| client_config.set_initial_max_streams_uni(3); | ||
| client_config.set_active_connection_id_limit(2); | ||
| // We don't need to allow the server to initiate connection migration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: QUICv1 does not permit servers to initiate migration any way, so perhaps a comment like below is more accurate
// Server's can't initiate migration but disable it explicitly anyway.
This PR consists of 4 separate commits. The first two are refactors to simplify bits of the internal and public API of tokio-quiche. On the public side, I removed the
socket_cookieparameter completely and made the CID generator aQuicListenerproperty. This means our users are expected to provide a generator for each socket now, with TryFrom defaulting toSimpleConnectionIdGenerator. Users that relied onsocket_cookiehave more flexibility now, as they can embed the cookie (or any other data they may require) directly in the CID generator instance. This is a breaking change.The third commit changes the IoWorker loop to top up quiche's supply of SCIDs in every iteration, as well as removing retired SCIDs from the
ConnectionMap. SCIDs are generated by the generator from theQuicListener(which was the reason for refactoring that API in the first place.) Each active connection receives its own Arc to the shared generator. This unblocks active connection migration for clients, as we already support passive migration where only the IP/port changes.Finally, the fourth commit adds a test to verify that active migration works correctly. Since active and passive migration scenarios are extremely similar, and both require low-level quiche access, I decided to add the active-migration-specific bits to the existing passive migration test case rather than copy-pasting the entire thing.