Fix error handling in Client consulDiscoveryImpl (#14431)

Added a missing `continue` on non-nil error to avoid accidentally using a bad peer.
This commit is contained in:
Tiernan
2022-09-03 05:13:03 +10:00
committed by GitHub
parent 7d88937751
commit df043d747c
2 changed files with 4 additions and 0 deletions

3
.changelog/14431.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
client: Fixed bug where clients could attempt to connect to servers with invalid addresses retrieved from Consul.
```

View File

@@ -2869,6 +2869,7 @@ DISCOLOOP:
addr, err := net.ResolveTCPAddr("tcp", p)
if err != nil {
mErr.Errors = append(mErr.Errors, err)
continue
}
srv := &servers.Server{Addr: addr}
nomadServers = append(nomadServers, srv)