Merge pull request #16 from TheoMcGinley/infinite-retries-fix
Fixed infinite retries for failed TCP dial
This commit is contained in:
commit
91a7cc9c64
|
@ -119,7 +119,7 @@ func (c *Client) Connect() (*Session, error) {
|
||||||
var try = 0
|
var try = 0
|
||||||
var success bool
|
var success bool
|
||||||
c.Metrics = initMetrics()
|
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 {
|
if tcpconn, err = net.DialTimeout("tcp", c.config.Address, time.Duration(c.config.ConnectTimeout)*time.Second); err == nil {
|
||||||
c.Metrics.setConnectTime()
|
c.Metrics.setConnectTime()
|
||||||
success = true
|
success = true
|
||||||
|
|
Loading…
Reference in a new issue