Keep targets around until their attempt fails
This commit is contained in:
1 parent
4335615688
commit
9d0af9dbfe
1 file changed
+10
-8
+10
-8
@@ -141,15 +141,17 @@ func (cm *ConnectionMaker) checkStateAndAttemptConnections(now time.Time) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
for address, target := range cm.targets {
|
for address, target := range cm.targets {
|
||||||
if validTarget[address] {
|
if target.state == CSUnconnected {
|
||||||
if target.state == CSUnconnected && now.After(target.tryAfter) {
|
if validTarget[address] {
|
||||||
target.attemptCount += 1
|
if now.After(target.tryAfter) {
|
||||||
target.state = CSAttempting
|
target.attemptCount += 1
|
||||||
go cm.attemptConnection(address, cm.cmdLineAddress[address])
|
target.state = CSAttempting
|
||||||
|
go cm.attemptConnection(address, cm.cmdLineAddress[address])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//log.Println("Deleting target no longer valid:", address)
|
||||||
|
delete(cm.targets, address)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//log.Println("Deleting target no longer valid:", address)
|
|
||||||
delete(cm.targets, address)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user