mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 19:08:58 +00:00
lib/model: Add pmut locking for DeviceStatistics (fixes #9274)
Looking at deviceConnIDs requires this. Added in #9256.
This commit is contained in:
parent
d0e407f3c3
commit
30fe2cf514
@ -812,6 +812,8 @@ func (m *model) ConnectionStats() map[string]interface{} {
|
|||||||
func (m *model) DeviceStatistics() (map[protocol.DeviceID]stats.DeviceStatistics, error) {
|
func (m *model) DeviceStatistics() (map[protocol.DeviceID]stats.DeviceStatistics, error) {
|
||||||
m.fmut.RLock()
|
m.fmut.RLock()
|
||||||
defer m.fmut.RUnlock()
|
defer m.fmut.RUnlock()
|
||||||
|
m.pmut.RLock()
|
||||||
|
defer m.pmut.RUnlock()
|
||||||
res := make(map[protocol.DeviceID]stats.DeviceStatistics, len(m.deviceStatRefs))
|
res := make(map[protocol.DeviceID]stats.DeviceStatistics, len(m.deviceStatRefs))
|
||||||
for id, sr := range m.deviceStatRefs {
|
for id, sr := range m.deviceStatRefs {
|
||||||
stats, err := sr.GetStatistics()
|
stats, err := sr.GetStatistics()
|
||||||
|
Loading…
Reference in New Issue
Block a user