clientv3: cancel the client if there is no endpoint

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
release-3.5
Ted Yu 2020-05-23 13:35:17 -07:00
parent e007d4f58d
commit dafd474677
1 changed files with 2 additions and 1 deletions

View File

@ -460,7 +460,8 @@ func newClient(cfg *Config) (*Client, error) {
client.resolverGroup.SetEndpoints(cfg.Endpoints)
if len(cfg.Endpoints) < 1 {
return nil, fmt.Errorf("at least one Endpoint must is required in client config")
client.cancel()
return nil, fmt.Errorf("at least one Endpoint is required in client config")
}
dialEndpoint := cfg.Endpoints[0]