routing: penalize node-level failures harder

Previously we only penalized the outgoing connections of a failing node.
This turned out not to be sufficient, because the next route sometimes
went into the same failing node again to try a different outgoing
connection that wasn't yet known to mission control and therefore not
penalized before.
This commit is contained in:
Joost Jager
2020-01-21 09:02:25 +01:00
parent ad0a89b844
commit ef28d2aaed
4 changed files with 26 additions and 15 deletions

View File

@@ -333,18 +333,18 @@ func (m *MissionControl) setLastPairResult(fromNode, toNode route.Vertex,
nodePairs[toNode] = current
}
// setAllFail stores a fail result for all known connection of the given node.
func (m *MissionControl) setAllFail(fromNode route.Vertex,
// setAllFail stores a fail result for all known connections to and from the
// given node.
func (m *MissionControl) setAllFail(node route.Vertex,
timestamp time.Time) {
nodePairs, ok := m.lastPairResult[fromNode]
if !ok {
return
}
for connection := range nodePairs {
nodePairs[connection] = TimedPairResult{
FailTime: timestamp,
for fromNode, nodePairs := range m.lastPairResult {
for toNode := range nodePairs {
if fromNode == node || toNode == node {
nodePairs[toNode] = TimedPairResult{
FailTime: timestamp,
}
}
}
}
}