From adf2c13a8cf5778efa5299cc6f19044e427ff458 Mon Sep 17 00:00:00 2001 From: Theo McGinley Date: Sat, 9 Feb 2019 14:35:31 +0000 Subject: [PATCH] Fixed infinite retries for failed TCP dial --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index d167341..7a17f45 100644 --- a/client.go +++ b/client.go @@ -119,7 +119,7 @@ func (c *Client) Connect() (*Session, error) { var try = 0 var success bool c.Metrics = initMetrics() - for try <= c.config.Retry || !success { + for try <= c.config.Retry && !success { if tcpconn, err = net.DialTimeout("tcp", c.config.Address, time.Duration(c.config.ConnectTimeout)*time.Second); err == nil { c.Metrics.setConnectTime() success = true