lib/model: Don't exit pullerRoutine on cancelled ctx (fixes #6559) (#6562)

* lib/model: Don't exit pullerRoutine on cancelled ctx (fixes #6559)

* actual fix
This commit is contained in:
Simon Frei
2020-04-21 18:55:14 +01:00
committed by GitHub
parent 6bbd24de12
commit d3ed4de4ed
4 changed files with 76 additions and 21 deletions
+5 -21
View File
@@ -1079,30 +1079,12 @@ func (f *sendReceiveFolder) handleFile(file protocol.FileInfo, snap *db.Snapshot
"action": "update",
})
s := sharedPullerState{
file: file,
fs: f.fs,
folder: f.folderID,
tempName: tempName,
realName: file.Name,
copyTotal: len(blocks),
copyNeeded: len(blocks),
reused: len(reused),
updated: time.Now(),
available: reused,
availableUpdated: time.Now(),
ignorePerms: f.IgnorePerms || file.NoPermissions,
hasCurFile: hasCurFile,
curFile: curFile,
mut: sync.NewRWMutex(),
sparse: !f.DisableSparseFiles,
created: time.Now(),
}
s := newSharedPullerState(file, f.fs, f.folderID, tempName, blocks, reused, f.IgnorePerms || file.NoPermissions, hasCurFile, curFile, !f.DisableSparseFiles)
l.Debugf("%v need file %s; copy %d, reused %v", f, file.Name, len(blocks), len(reused))
cs := copyBlocksState{
sharedPullerState: &s,
sharedPullerState: s,
blocks: blocks,
have: len(have),
}
@@ -1384,7 +1366,9 @@ func (f *sendReceiveFolder) pullerRoutine(in <-chan pullBlockState, out chan<- *
bytes := int(state.block.Size)
if err := requestLimiter.takeWithContext(f.ctx, bytes); err != nil {
break
state.fail(err)
out <- state.sharedPullerState
continue
}
wg.Add(1)