cosmetic
This commit is contained in:
1 parent
cd92fad369
commit
634d4e0fe3
2 files changed
+8
-8
No files matched your search
+7
-7
@@ -95,6 +95,7 @@ func (cm *ConnectionMaker) queryLoop(queryChan <-chan *ConnectionMakerInteractio
|
|||||||
|
|
||||||
func (cm *ConnectionMaker) checkStateAndAttemptConnections(now time.Time) {
|
func (cm *ConnectionMaker) checkStateAndAttemptConnections(now time.Time) {
|
||||||
ourself := cm.router.Ourself
|
ourself := cm.router.Ourself
|
||||||
|
|
||||||
// Any targets that are now connected, we don't need to attempt any more
|
// Any targets that are now connected, we don't need to attempt any more
|
||||||
for address, target := range cm.targets {
|
for address, target := range cm.targets {
|
||||||
if _, found := ourself.ConnectionOn(address); found {
|
if _, found := ourself.ConnectionOn(address); found {
|
||||||
@@ -108,6 +109,7 @@ func (cm *ConnectionMaker) checkStateAndAttemptConnections(now time.Time) {
|
|||||||
delete(cm.targets, address)
|
delete(cm.targets, address)
|
||||||
}
|
}
|
||||||
} else if target.isCmdLine {
|
} else if target.isCmdLine {
|
||||||
|
// This is a target that we are not connected to - if we are not currently attempting to connect, make sure we record it as unconnected
|
||||||
if target.state != CSAttempting {
|
if target.state != CSAttempting {
|
||||||
target.state = CSUnconnected
|
target.state = CSUnconnected
|
||||||
}
|
}
|
||||||
@@ -135,13 +137,11 @@ func (cm *ConnectionMaker) checkStateAndAttemptConnections(now time.Time) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
{
|
for address, target := range cm.targets {
|
||||||
for address, target := range cm.targets {
|
if target.state == CSUnconnected && now.After(target.tryAfter) {
|
||||||
if target.state == CSUnconnected && now.After(target.tryAfter) {
|
target.attemptCount += 1
|
||||||
target.attemptCount += 1
|
target.state = CSAttempting
|
||||||
target.state = CSAttempting
|
go cm.attemptConnection(address, target.isCmdLine)
|
||||||
go cm.attemptConnection(address, target.isCmdLine)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user