Преглед изворни кода

lib/model: Correct lock taking order in ConnectionStats (fixes #3596)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3597
Jakob Borg пре 9 година
родитељ
комит
da0b7cc7f2
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      lib/model/model.go

+ 2 - 2
lib/model/model.go

@@ -396,8 +396,8 @@ func (info ConnectionInfo) MarshalJSON() ([]byte, error) {
 
 // ConnectionStats returns a map with connection statistics for each device.
 func (m *Model) ConnectionStats() map[string]interface{} {
-	m.pmut.RLock()
 	m.fmut.RLock()
+	m.pmut.RLock()
 
 	res := make(map[string]interface{})
 	devs := m.cfg.Devices()
@@ -426,8 +426,8 @@ func (m *Model) ConnectionStats() map[string]interface{} {
 
 	res["connections"] = conns
 
-	m.fmut.RUnlock()
 	m.pmut.RUnlock()
+	m.fmut.RUnlock()
 
 	in, out := protocol.TotalInOut()
 	res["total"] = ConnectionInfo{