This commit is contained in:
Mateusz Gruszczyński committed 2026-10-13 23:34:10 +02:00
1 parent 00218a72df
commit 4a3e4bcf8f
10 files changed
+745 -331

No files matched your search

+4 -1
View File
@@ -86,9 +86,12 @@ pub(crate) fn configured_hostnames(config: &Config) -> Result<Vec<String>> {
}
async fn resolve(name: String) -> (String, Option<Addresses>) {
// Keep the returned cache key owned independently of the DNS lookup future.
// The lookup result can retain the borrowed hostname until it is dropped.
let lookup_name = name.clone();
let answer = tokio::time::timeout(
Duration::from_secs(LOOKUP_SECONDS),
tokio::net::lookup_host((name.as_str(), 0u16)),
tokio::net::lookup_host((lookup_name.as_str(), 0u16)),
).await;
let mut ips = match answer {
Ok(Ok(sockets)) => sockets.map(|socket| socket.ip()).collect::<Vec<_>>(),