Fix panic when DNS resolution for STUN server returns only IPv6 addrs. (#402)

This commit is contained in:
Hs_Yeah 2024-10-09 22:40:01 +08:00 committed by GitHub
parent e344372616
commit d9453589ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,6 +56,8 @@ impl HostResolverIter {
self.ips = ips
.filter(|x| x.is_ipv4())
.choose_multiple(&mut rand::thread_rng(), self.max_ip_per_domain as usize);
if self.ips.is_empty() {return self.next().await;}
}
Err(e) => {
tracing::warn!(?host, ?e, "lookup host for stun failed");