fix: 并发dns查询,由于ipv6阻塞导致某些情况下的网络不通

This commit is contained in:
gVisor bot 2022-05-21 00:34:00 +08:00
parent ba7e0887bd
commit 98ca305a54

View file

@ -82,12 +82,16 @@ func (r *Resolver) ResolveAllIP(host string) (ips []netip.Addr, err error) {
ips, err = r.resolveIP(host, D.TypeA)
ipv6s, open := <-ch
select {
case ipv6s, open := <-ch:
if !open && err != nil {
return nil, resolver.ErrIPNotFound
}
ips = append(ips, ipv6s...)
case <-time.After(3 * time.Millisecond):
// wait ipv6 3ms
}
return ips, nil
}