Skip to content

Commit

Permalink
Fix error handling in Client consulDiscoveryImpl (#14431)
Browse files Browse the repository at this point in the history
Added a missing `continue` on non-nil error to avoid accidentally using a bad peer.
  • Loading branch information
nvx committed Sep 2, 2022
1 parent 7d88937 commit df043d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/14431.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
client: Fixed bug where clients could attempt to connect to servers with invalid addresses retrieved from Consul.
```
1 change: 1 addition & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit df043d7

Please sign in to comment.