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])
@@ -152,6 +153,7 @@ func (cm *ConnectionMaker) checkStateAndAttemptConnections(now time.Time) {
delete(cm.targets, address) delete(cm.targets, address)
} }
} }
}
} }
func (cm *ConnectionMaker) addToTargets(address string) { func (cm *ConnectionMaker) addToTargets(address string) {