lib/model: Fix locking when resending cluster-configs (#7107)

This commit is contained in:
Simon Frei 2020-11-09 14:05:21 +01:00 committed by GitHub
parent 326111d10f
commit 54643e86b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2375,13 +2375,18 @@ func (m *model) CommitConfiguration(from, to config.Configuration) bool {
go conn.Close(errDeviceRemoved)
}
}
ccConns := make([]protocol.Connection, 0, len(clusterConfigDevices))
for id := range clusterConfigDevices {
if conn, ok := m.conn[id]; ok {
cm := m.generateClusterConfig(conn.ID())
go conn.ClusterConfig(cm)
ccConns = append(ccConns, conn)
}
}
m.pmut.RUnlock()
// Generating cluster-configs acquires fmut -> must happen outside of pmut.
for _, conn := range ccConns {
cm := m.generateClusterConfig(conn.ID())
go conn.ClusterConfig(cm)
}
m.globalRequestLimiter.setCapacity(1024 * to.Options.MaxConcurrentIncomingRequestKiB())
m.folderIOLimiter.setCapacity(to.Options.MaxFolderConcurrency())