lib/model: Fix lock order

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3823
This commit is contained in:
AudriusButkevicius 2016-12-21 12:22:18 +00:00 committed by Jakob Borg
parent 5c067661f4
commit aa3ef49dd7

View File

@ -1347,10 +1347,11 @@ func (m *Model) AddConnection(conn connections.Connection, hello protocol.HelloR
l.Infof(`Device %s client is "%s %s" named "%s"`, deviceID, hello.ClientName, hello.ClientVersion, hello.DeviceName)
conn.Start()
m.pmut.Unlock()
// Acquires fmut, so has to be done outside of pmut.
cm := m.generateClusterConfig(deviceID)
conn.ClusterConfig(cm)
m.pmut.Unlock()
device, ok := m.cfg.Devices()[deviceID]
if ok && (device.Name == "" || m.cfg.Options().OverwriteRemoteDevNames) {