mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2025-01-12 07:28:13 +01:00
Fix AdditionalCost bug
This commit is contained in:
parent
91d8e92b39
commit
2e0787bb63
12
path/path.go
12
path/path.go
@ -246,10 +246,10 @@ func (g *IG) Weight(u, v config.Vertex, withAC bool) (ret float64) {
|
||||
if time.Now().After(g.edges[u][v].time.Add(g.NodeReportTimeout)) {
|
||||
return Infinity
|
||||
}
|
||||
if withAC {
|
||||
ret = g.edges[u][v].ping + g.edges[u][v].additionalCost
|
||||
}
|
||||
ret = g.edges[u][v].ping
|
||||
if withAC {
|
||||
ret += g.edges[u][v].additionalCost
|
||||
}
|
||||
if ret >= Infinity {
|
||||
return Infinity
|
||||
}
|
||||
@ -268,10 +268,10 @@ func (g *IG) OldWeight(u, v config.Vertex, withAC bool) (ret float64) {
|
||||
if _, ok := g.edges[u][v]; !ok {
|
||||
return Infinity
|
||||
}
|
||||
if withAC {
|
||||
ret = g.edges[u][v].ping_old + g.edges[u][v].additionalCost
|
||||
}
|
||||
ret = g.edges[u][v].ping_old
|
||||
if withAC {
|
||||
ret += g.edges[u][v].additionalCost
|
||||
}
|
||||
if ret >= Infinity {
|
||||
return Infinity
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user