lib/db need not depend on lib/config

This commit is contained in:
Jakob Borg
2015-09-04 12:01:00 +02:00
parent 54269553c8
commit 4a9997e449
5 changed files with 34 additions and 70 deletions

View File

@@ -1107,15 +1107,17 @@ func (p *rwFolder) copierRoutine(in <-chan copyBlocksState, pullChan chan<- pull
}
folderRoots := make(map[string]string)
var folders []string
p.model.fmut.RLock()
for folder, cfg := range p.model.folderCfgs {
folderRoots[folder] = cfg.Path()
folders = append(folders, folder)
}
p.model.fmut.RUnlock()
for _, block := range state.blocks {
buf = buf[:int(block.Size)]
found := p.model.finder.Iterate(block.Hash, func(folder, file string, index int32) bool {
found := p.model.finder.Iterate(folders, block.Hash, func(folder, file string, index int32) bool {
fd, err := os.Open(filepath.Join(folderRoots[folder], file))
if err != nil {
return false