浏览代码

lib/model: Fix lock order

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3823
AudriusButkevicius 8 年之前
父节点
当前提交
aa3ef49dd7
共有 1 个文件被更改,包括 2 次插入1 次删除
  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) {