Only buffer file names, not full &FileInfo

This commit is contained in:
Jakob Borg
2014-12-30 09:31:34 +01:00
parent 34deb82aea
commit 2496185629
5 changed files with 68 additions and 82 deletions

View File

@@ -340,7 +340,7 @@ func (p *Puller) pullerIteration(checksum bool, ignores *ignore.Matcher) int {
default:
// A new or changed file or symlink. This is the only case where we
// do stuff concurrently in the background
p.queue.Push(&file)
p.queue.Push(file.Name)
}
changed++
@@ -348,11 +348,12 @@ func (p *Puller) pullerIteration(checksum bool, ignores *ignore.Matcher) int {
})
for {
f := p.queue.Pop()
if f == nil {
fileName, ok := p.queue.Pop()
if !ok {
break
}
p.handleFile(*f, copyChan, finisherChan)
f := p.model.CurrentGlobalFile(p.folder, fileName)
p.handleFile(f, copyChan, finisherChan)
}
// Signal copy and puller routines that we are done with the in data for
@@ -492,7 +493,7 @@ func (p *Puller) handleFile(file protocol.FileInfo, copyChan chan<- copyBlocksSt
if debug {
l.Debugln(p, "taking shortcut on", file.Name)
}
p.queue.Done(&file)
p.queue.Done(file.Name)
if file.IsSymlink() {
p.shortcutSymlink(curFile, file)
} else {
@@ -860,7 +861,7 @@ func (p *Puller) finisherRoutine(in <-chan *sharedPullerState) {
continue
}
p.queue.Done(&state.file)
p.queue.Done(state.file.Name)
p.performFinish(state)
p.model.receivedFile(p.folder, state.file.Name)
if p.progressEmitter != nil {
@@ -875,7 +876,7 @@ func (p *Puller) Bump(filename string) {
p.queue.Bump(filename)
}
func (p *Puller) Jobs() ([]protocol.FileInfoTruncated, []protocol.FileInfoTruncated) {
func (p *Puller) Jobs() ([]string, []string) {
return p.queue.Jobs()
}