lib/model: Correct lock taking order in ConnectionStats (fixes #3596)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3597
This commit is contained in:
parent
139e9b144e
commit
da0b7cc7f2
@ -396,8 +396,8 @@ func (info ConnectionInfo) MarshalJSON() ([]byte, error) {
|
|||||||
|
|
||||||
// ConnectionStats returns a map with connection statistics for each device.
|
// ConnectionStats returns a map with connection statistics for each device.
|
||||||
func (m *Model) ConnectionStats() map[string]interface{} {
|
func (m *Model) ConnectionStats() map[string]interface{} {
|
||||||
m.pmut.RLock()
|
|
||||||
m.fmut.RLock()
|
m.fmut.RLock()
|
||||||
|
m.pmut.RLock()
|
||||||
|
|
||||||
res := make(map[string]interface{})
|
res := make(map[string]interface{})
|
||||||
devs := m.cfg.Devices()
|
devs := m.cfg.Devices()
|
||||||
@ -426,8 +426,8 @@ func (m *Model) ConnectionStats() map[string]interface{} {
|
|||||||
|
|
||||||
res["connections"] = conns
|
res["connections"] = conns
|
||||||
|
|
||||||
m.fmut.RUnlock()
|
|
||||||
m.pmut.RUnlock()
|
m.pmut.RUnlock()
|
||||||
|
m.fmut.RUnlock()
|
||||||
|
|
||||||
in, out := protocol.TotalInOut()
|
in, out := protocol.TotalInOut()
|
||||||
res["total"] = ConnectionInfo{
|
res["total"] = ConnectionInfo{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user