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 1ae26981a0
commit 98022376be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)