Skip to content
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

Support 0-RTT in DNS over QUIC #1716

Merged
merged 1 commit into from
Jun 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crates/proto/src/quic/quic_client_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ impl QuicClientStreamBuilder {
if crypto_config.alpn_protocols.is_empty() {
crypto_config.alpn_protocols = vec![quic_stream::DOQ_ALPN.to_vec()];
}
let early_data_enabled = crypto_config.enable_early_data;

let mut client_config = ClientConfig::new(Arc::new(crypto_config));
client_config.transport = self.transport_config;
Expand All @@ -205,7 +206,14 @@ impl QuicClientStreamBuilder {
let connecting = endpoint.connect(name_server, &dns_name)?;
// TODO: for Client/Dynamic update, don't use RTT, for queries, do use it.

let connection = connecting.await?;
let connection = if early_data_enabled {
match connecting.into_0rtt() {
Ok((new_connection, _)) => new_connection,
Err(connecting) => connecting.await?,
}
} else {
connecting.await?
};
let NewConnection {
connection: quic_connection,
..
Expand Down