mirror of
https://github.com/FluuxIO/go-xmpp.git
synced 2024-11-24 19:42:00 -08:00
Fixed infinite retries for failed TCP dial
This commit is contained in:
parent
c0f3d20440
commit
adf2c13a8c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user