diff --git a/lib/model/folder_sendrecv.go b/lib/model/folder_sendrecv.go index 69669dfd..86774eb2 100644 --- a/lib/model/folder_sendrecv.go +++ b/lib/model/folder_sendrecv.go @@ -265,7 +265,7 @@ func (f *sendReceiveFolder) pullerIteration(scanChan chan<- string) int { doneWg.Done() }() - changed, fileDeletions, dirDeletions, err := f.processNeeded(dbUpdateChan, copyChan, finisherChan, scanChan) + changed, fileDeletions, dirDeletions, err := f.processNeeded(dbUpdateChan, copyChan, scanChan) // Signal copy and puller routines that we are done with the in data for // this iteration. Wait for them to finish. @@ -290,7 +290,7 @@ func (f *sendReceiveFolder) pullerIteration(scanChan chan<- string) int { return changed } -func (f *sendReceiveFolder) processNeeded(dbUpdateChan chan<- dbUpdateJob, copyChan chan<- copyBlocksState, finisherChan chan<- *sharedPullerState, scanChan chan<- string) (int, map[string]protocol.FileInfo, []protocol.FileInfo, error) { +func (f *sendReceiveFolder) processNeeded(dbUpdateChan chan<- dbUpdateJob, copyChan chan<- copyBlocksState, scanChan chan<- string) (int, map[string]protocol.FileInfo, []protocol.FileInfo, error) { changed := 0 var processDirectly []protocol.FileInfo var dirDeletions []protocol.FileInfo @@ -488,7 +488,7 @@ nextFile: if _, ok := f.model.Connection(dev); ok { changed++ // Handle the file normally, by coping and pulling, etc. - f.handleFile(fi, copyChan, finisherChan, dbUpdateChan) + f.handleFile(fi, copyChan, dbUpdateChan) continue nextFile } } @@ -1017,7 +1017,7 @@ func (f *sendReceiveFolder) renameFile(cur, source, target protocol.FileInfo, db // handleFile queues the copies and pulls as necessary for a single new or // changed file. -func (f *sendReceiveFolder) handleFile(file protocol.FileInfo, copyChan chan<- copyBlocksState, finisherChan chan<- *sharedPullerState, dbUpdateChan chan<- dbUpdateJob) { +func (f *sendReceiveFolder) handleFile(file protocol.FileInfo, copyChan chan<- copyBlocksState, dbUpdateChan chan<- dbUpdateJob) { curFile, hasCurFile := f.fset.Get(protocol.LocalDeviceID, file.Name) have, need := blockDiff(curFile.Blocks, file.Blocks) diff --git a/lib/model/folder_sendrecv_test.go b/lib/model/folder_sendrecv_test.go index 84d86519..908a84ad 100644 --- a/lib/model/folder_sendrecv_test.go +++ b/lib/model/folder_sendrecv_test.go @@ -145,7 +145,7 @@ func TestHandleFile(t *testing.T) { copyChan := make(chan copyBlocksState, 1) dbUpdateChan := make(chan dbUpdateJob, 1) - f.handleFile(requiredFile, copyChan, nil, dbUpdateChan) + f.handleFile(requiredFile, copyChan, dbUpdateChan) // Receive the results toCopy := <-copyChan @@ -195,7 +195,7 @@ func TestHandleFileWithTemp(t *testing.T) { copyChan := make(chan copyBlocksState, 1) dbUpdateChan := make(chan dbUpdateJob, 1) - f.handleFile(requiredFile, copyChan, nil, dbUpdateChan) + f.handleFile(requiredFile, copyChan, dbUpdateChan) // Receive the results toCopy := <-copyChan @@ -253,7 +253,7 @@ func TestCopierFinder(t *testing.T) { // Run a single fetcher routine go f.copierRoutine(copyChan, pullChan, finisherChan) - f.handleFile(requiredFile, copyChan, finisherChan, dbUpdateChan) + f.handleFile(requiredFile, copyChan, dbUpdateChan) pulls := []pullBlockState{<-pullChan, <-pullChan, <-pullChan, <-pullChan} finish := <-finisherChan @@ -374,7 +374,7 @@ func TestWeakHash(t *testing.T) { // Test 1 - no weak hashing, file gets fully repulled (`expectBlocks` pulls). fo.WeakHashThresholdPct = 101 - fo.handleFile(desiredFile, copyChan, finisherChan, dbUpdateChan) + fo.handleFile(desiredFile, copyChan, dbUpdateChan) var pulls []pullBlockState for len(pulls) < expectBlocks { @@ -402,7 +402,7 @@ func TestWeakHash(t *testing.T) { // Test 2 - using weak hash, expectPulls blocks pulled. fo.WeakHashThresholdPct = -1 - fo.handleFile(desiredFile, copyChan, finisherChan, dbUpdateChan) + fo.handleFile(desiredFile, copyChan, dbUpdateChan) pulls = pulls[:0] for len(pulls) < expectPulls { @@ -493,7 +493,7 @@ func TestDeregisterOnFailInCopy(t *testing.T) { go f.copierRoutine(copyChan, pullChan, finisherBufferChan) go f.finisherRoutine(finisherChan, dbUpdateChan, make(chan string)) - f.handleFile(file, copyChan, finisherChan, dbUpdateChan) + f.handleFile(file, copyChan, dbUpdateChan) // Receive a block at puller, to indicate that at least a single copier // loop has been performed. @@ -584,7 +584,7 @@ func TestDeregisterOnFailInPull(t *testing.T) { go f.pullerRoutine(pullChan, finisherBufferChan) go f.finisherRoutine(finisherChan, dbUpdateChan, make(chan string)) - f.handleFile(file, copyChan, finisherChan, dbUpdateChan) + f.handleFile(file, copyChan, dbUpdateChan) // Receive at finisher, we should error out as puller has nowhere to pull // from. @@ -832,7 +832,7 @@ func TestCopyOwner(t *testing.T) { defer close(copierChan) go f.copierRoutine(copierChan, nil, finisherChan) go f.finisherRoutine(finisherChan, dbUpdateChan, nil) - f.handleFile(file, copierChan, nil, nil) + f.handleFile(file, copierChan, nil) <-dbUpdateChan info, err = f.fs.Lstat("foo/bar/baz")