Browse Source

lib/model: Fix lock order

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3823
AudriusButkevicius 8 years ago
parent
commit
aa3ef49dd7
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/model/model.go

+ 2 - 1
lib/model/model.go

@@ -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) {