mirror of
https://github.com/octoleo/syncthing.git
synced 2025-03-21 10:12:21 +00:00
Smarter initial index sending
This commit is contained in:
parent
ecc6476308
commit
10e8861f14
@ -423,14 +423,16 @@ func (m *Model) AddConnection(rawConn io.Closer, protoConn protocol.Connection)
|
|||||||
cm := m.clusterConfig(nodeID)
|
cm := m.clusterConfig(nodeID)
|
||||||
protoConn.ClusterConfig(cm)
|
protoConn.ClusterConfig(cm)
|
||||||
|
|
||||||
|
var idxToSend = make(map[string][]protocol.FileInfo)
|
||||||
|
|
||||||
|
m.rmut.RLock()
|
||||||
|
for _, repo := range m.nodeRepos[nodeID] {
|
||||||
|
idxToSend[repo] = m.protocolIndex(repo)
|
||||||
|
}
|
||||||
|
m.rmut.RUnlock()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
m.rmut.RLock()
|
for repo, idx := range idxToSend {
|
||||||
repos := m.nodeRepos[nodeID]
|
|
||||||
m.rmut.RUnlock()
|
|
||||||
for _, repo := range repos {
|
|
||||||
m.rmut.RLock()
|
|
||||||
idx := m.protocolIndex(repo)
|
|
||||||
m.rmut.RUnlock()
|
|
||||||
if debugNet {
|
if debugNet {
|
||||||
dlog.Printf("IDX(out/initial): %s: %q: %d files", nodeID, repo, len(idx))
|
dlog.Printf("IDX(out/initial): %s: %q: %d files", nodeID, repo, len(idx))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user