Skip to content

Commit

Permalink
lib/model: Add pmut locking for DeviceStatistics (fixes #9274)
Browse files Browse the repository at this point in the history
Looking at deviceConnIDs requires this. Added in #9256.
  • Loading branch information
calmh committed Dec 11, 2023
1 parent 3850a08 commit 48883e0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 48883e0

Please sign in to comment.