From 3850a08252ecc5fdd8a5f3257628d3f03f2cd641 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 11 Dec 2023 07:42:39 +0100 Subject: [PATCH 1/2] lib/model: Remove spurious "replacing service" failure event (ref #9271) This is no longer a notable condition, as we do this pretty much all the time. --- lib/model/service_map.go | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/model/service_map.go b/lib/model/service_map.go index 0eed99cfc..7eaf94506 100644 --- a/lib/model/service_map.go +++ b/lib/model/service_map.go @@ -46,7 +46,6 @@ func (s *serviceMap[K, S]) Add(k K, v S) { if tok, ok := s.tokens[k]; ok { // There is already a service at this key, remove it first. s.supervisor.Remove(tok) - s.eventLogger.Log(events.Failure, fmt.Sprintf("%s replaced service at key %v", s, k)) } s.services[k] = v s.tokens[k] = s.supervisor.Add(v) From 48883e0e32b117030e58ac6d89c267e48da8bb38 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 11 Dec 2023 08:02:25 +0100 Subject: [PATCH 2/2] lib/model: Add pmut locking for DeviceStatistics (fixes #9274) Looking at deviceConnIDs requires this. Added in #9256. --- lib/model/model.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/model/model.go b/lib/model/model.go index 878ef9d73..bd87968d9 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -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()