[BUGFIX] mutex like it should be

This commit is contained in:
Martin Geno 2017-03-07 18:02:32 +01:00
parent dc24c8b250
commit 34a920e01f
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
2 changed files with 4 additions and 2 deletions

View File

@ -50,7 +50,9 @@ func BuildGraph(nodes *runtime.Nodes) *Graph {
vpn: make(map[string]interface{}),
}
nodes.RLock()
builder.readNodes(nodes.List)
nodes.RUnlock()
graph := &Graph{Version: 1}
graph.Batadv.Directed = false

View File

@ -23,7 +23,7 @@ func NewGlobalStats(nodes *Nodes) (result *GlobalStats) {
Models: make(CounterMap),
}
nodes.Lock()
nodes.RLock()
for _, node := range nodes.List {
if node.Online {
result.Nodes++
@ -42,7 +42,7 @@ func NewGlobalStats(nodes *Nodes) (result *GlobalStats) {
}
}
}
nodes.Unlock()
nodes.RUnlock()
return
}