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

feat(iroh-net): small improvements to dns behaviour #2290

Closed
Changes from 3 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
6 changes: 5 additions & 1 deletion iroh-net/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ fn create_default_resolver() -> Result<TokioAsyncResolver> {
}
}

// lookup IPv4 and IPv6 in parallel
// ensure multiple name servers are queried concurrently
options.num_concurrent_reqs = 3;
Comment on lines +70 to +71
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, only just realised this comment. It queries multiple DNS servers concurrently, but we typically only have a single DNS server. We want (I think) to be robust in case the UDP packet to this server is lost and thus do multiple concurrent requests to the same server, but with staggered starts so that you don't always pay the price of the multiple requests if your DNS server is fast enough.

options.timeout = std::time::Duration::from_millis(450);

// see [`lookup_ipv4_ipv6`] for info on why we avoid LookupIpStrategy::Ipv4AndIpv6
options.ip_strategy = hickory_resolver::config::LookupIpStrategy::Ipv4thenIpv6;

let resolver = AsyncResolver::tokio(config, options);
Expand Down
Loading