mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-10 07:11:08 +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
3850a08252
commit
48883e0e32
@ -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