[BUGFIX] mutex like it should be
This commit is contained in:
parent
dc24c8b250
commit
34a920e01f
|
@ -50,7 +50,9 @@ func BuildGraph(nodes *runtime.Nodes) *Graph {
|
||||||
vpn: make(map[string]interface{}),
|
vpn: make(map[string]interface{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodes.RLock()
|
||||||
builder.readNodes(nodes.List)
|
builder.readNodes(nodes.List)
|
||||||
|
nodes.RUnlock()
|
||||||
|
|
||||||
graph := &Graph{Version: 1}
|
graph := &Graph{Version: 1}
|
||||||
graph.Batadv.Directed = false
|
graph.Batadv.Directed = false
|
||||||
|
|
|
@ -23,7 +23,7 @@ func NewGlobalStats(nodes *Nodes) (result *GlobalStats) {
|
||||||
Models: make(CounterMap),
|
Models: make(CounterMap),
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes.Lock()
|
nodes.RLock()
|
||||||
for _, node := range nodes.List {
|
for _, node := range nodes.List {
|
||||||
if node.Online {
|
if node.Online {
|
||||||
result.Nodes++
|
result.Nodes++
|
||||||
|
@ -42,7 +42,7 @@ func NewGlobalStats(nodes *Nodes) (result *GlobalStats) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nodes.Unlock()
|
nodes.RUnlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue