lib/model: Add pmut locking for DeviceStatistics (fixes #9274)

Looking at deviceConnIDs requires this. Added in #9256.
This commit is contained in:
Jakob Borg 2023-12-11 08:02:25 +01:00
parent d0e407f3c3
commit 30fe2cf514

View File

@ -812,6 +812,8 @@ func (m *model) ConnectionStats() map[string]interface{} {
func (m *model) DeviceStatistics() (map[protocol.DeviceID]stats.DeviceStatistics, error) {
m.fmut.RLock()
defer m.fmut.RUnlock()
m.pmut.RLock()
defer m.pmut.RUnlock()
res := make(map[protocol.DeviceID]stats.DeviceStatistics, len(m.deviceStatRefs))
for id, sr := range m.deviceStatRefs {
stats, err := sr.GetStatistics()