mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
Lock while accessing folder configs
This commit is contained in:
parent
1aaf34b0ed
commit
d16dcb9f19
@ -592,11 +592,18 @@ nextFile:
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
folderRoots := make(map[string]string)
|
||||||
|
p.model.fmut.RLock()
|
||||||
|
for folder, cfg := range p.model.folderCfgs {
|
||||||
|
folderRoots[folder] = cfg.Path
|
||||||
|
}
|
||||||
|
p.model.fmut.RUnlock()
|
||||||
|
|
||||||
hasher := sha256.New()
|
hasher := sha256.New()
|
||||||
for _, block := range state.blocks {
|
for _, block := range state.blocks {
|
||||||
buf = buf[:int(block.Size)]
|
buf = buf[:int(block.Size)]
|
||||||
found := p.model.finder.Iterate(block.Hash, func(folder, file string, index uint32) bool {
|
found := p.model.finder.Iterate(block.Hash, func(folder, file string, index uint32) bool {
|
||||||
path := filepath.Join(p.model.folderCfgs[folder].Path, file)
|
path := filepath.Join(folderRoots[folder], file)
|
||||||
|
|
||||||
var fd *os.File
|
var fd *os.File
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user