mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
Hold rmut read lock when looking at nodeStatRefs
This commit is contained in:
parent
75b26513e1
commit
cf1bfdfb61
@ -209,9 +209,11 @@ func (m *Model) ConnectionStats() map[string]ConnectionInfo {
|
|||||||
// Returns statistics about each node
|
// Returns statistics about each node
|
||||||
func (m *Model) NodeStatistics() map[string]stats.NodeStatistics {
|
func (m *Model) NodeStatistics() map[string]stats.NodeStatistics {
|
||||||
var res = make(map[string]stats.NodeStatistics)
|
var res = make(map[string]stats.NodeStatistics)
|
||||||
|
m.rmut.RLock()
|
||||||
for _, node := range m.cfg.Nodes {
|
for _, node := range m.cfg.Nodes {
|
||||||
res[node.NodeID.String()] = m.nodeStatRefs[node.NodeID].GetStatistics()
|
res[node.NodeID.String()] = m.nodeStatRefs[node.NodeID].GetStatistics()
|
||||||
}
|
}
|
||||||
|
m.rmut.RUnlock()
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user