Keep targets around until their attempt fails

This commit is contained in:
Bryan Boreham committed 2014-09-10 14:18:41 +01:00
1 parent 4335615688
commit 9d0af9dbfe
1 file changed
+3 -1
+3 -1
View File
@@ -141,8 +141,9 @@ func (cm *ConnectionMaker) checkStateAndAttemptConnections(now time.Time) {
}) })
for address, target := range cm.targets { for address, target := range cm.targets {
if target.state == CSUnconnected {
if validTarget[address] { if validTarget[address] {
if target.state == CSUnconnected && now.After(target.tryAfter) { if now.After(target.tryAfter) {
target.attemptCount += 1 target.attemptCount += 1
target.state = CSAttempting target.state = CSAttempting
go cm.attemptConnection(address, cm.cmdLineAddress[address]) go cm.attemptConnection(address, cm.cmdLineAddress[address])
@@ -153,6 +154,7 @@ func (cm *ConnectionMaker) checkStateAndAttemptConnections(now time.Time) {
} }
} }
} }
}
func (cm *ConnectionMaker) addToTargets(address string) { func (cm *ConnectionMaker) addToTargets(address string) {
target := cm.targets[address] target := cm.targets[address]