Fixes RTT command to only compare coordinates in the same area.
This commit is contained in:
parent
28f8aa5559
commit
43d24b3ba0
|
@ -102,21 +102,29 @@ func (c *RTTCommand) Run(args []string) int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if the requested nodes are in there.
|
// See if the requested nodes are in there. We only compare
|
||||||
|
// coordinates in the same areas.
|
||||||
|
var area1, area2 string
|
||||||
for _, dc := range dcs {
|
for _, dc := range dcs {
|
||||||
for _, entry := range dc.Coordinates {
|
for _, entry := range dc.Coordinates {
|
||||||
if dc.Datacenter == dc1 && entry.Node == node1 {
|
if dc.Datacenter == dc1 && entry.Node == node1 {
|
||||||
|
area1 = dc.AreaID
|
||||||
coord1 = entry.Coord
|
coord1 = entry.Coord
|
||||||
}
|
}
|
||||||
if dc.Datacenter == dc2 && entry.Node == node2 {
|
if dc.Datacenter == dc2 && entry.Node == node2 {
|
||||||
|
area2 = dc.AreaID
|
||||||
coord2 = entry.Coord
|
coord2 = entry.Coord
|
||||||
}
|
}
|
||||||
|
|
||||||
if coord1 != nil && coord2 != nil {
|
if area1 == area2 && coord1 != nil && coord2 != nil {
|
||||||
goto SHOW_RTT
|
goto SHOW_RTT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Nil out the coordinates so we don't display across areas if
|
||||||
|
// we didn't find anything.
|
||||||
|
coord1, coord2 = nil, nil
|
||||||
} else {
|
} else {
|
||||||
source = "LAN"
|
source = "LAN"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue