Skip to content

Commit

Permalink
fix: resolve_preference should only assign each ip once
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyxdd committed Aug 13, 2022
1 parent 1462cad commit 88099ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/transport/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func resolveIPAddrWithPreference(host string, pref ResolvePreference) (*net.IPAd
var ip4, ip6 *net.IPAddr
for i := range ips {
ip := &ips[i]
if ip.IP.To4() != nil {
if ip4 == nil && ip.IP.To4() != nil {
ip4 = ip
} else {
} else if ip6 == nil && ip.IP.To4() == nil {
ip6 = ip
}
if ip4 != nil && ip6 != nil {
Expand Down

0 comments on commit 88099ee

Please sign in to comment.