connmgr: check for canceled connection before connect
This will ensure cancelation is reliable for all cases.
This commit is contained in:
parent
aa6e0f3570
commit
9bfb2ca034
1 changed files with 8 additions and 0 deletions
|
@ -408,6 +408,14 @@ func (cm *ConnManager) Connect(c *ConnReq) {
|
||||||
if atomic.LoadInt32(&cm.stop) != 0 {
|
if atomic.LoadInt32(&cm.stop) != 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// During the time we wait for retry there is a chance that
|
||||||
|
// this connection was already cancelled
|
||||||
|
if c.State() == ConnCanceled {
|
||||||
|
log.Debugf("Ignoring connect for canceled connreq=%v", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if atomic.LoadUint64(&c.id) == 0 {
|
if atomic.LoadUint64(&c.id) == 0 {
|
||||||
atomic.StoreUint64(&c.id, atomic.AddUint64(&cm.connReqCount, 1))
|
atomic.StoreUint64(&c.id, atomic.AddUint64(&cm.connReqCount, 1))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue