SetServer command actually returns an error if given an invalid server
This commit is contained in:
parent
3f786b904b
commit
c8c1284bc3
|
@ -602,6 +602,16 @@ func (c *Client) SetServers(in []string) error {
|
|||
continue
|
||||
}
|
||||
|
||||
// Try to ping to check if it is a real server
|
||||
ok, err := c.Ping(addr)
|
||||
if err != nil {
|
||||
merr.Errors = append(merr.Errors, fmt.Errorf("Server at address %s failed ping: %v", addr, err))
|
||||
continue
|
||||
} else if !ok {
|
||||
merr.Errors = append(merr.Errors, fmt.Errorf("Server at address %s didn't respond to ping", addr))
|
||||
continue
|
||||
}
|
||||
|
||||
endpoints = append(endpoints, &servers.Server{Addr: addr})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue