lib/model: Add missing lock on download-state (fixes #6880) (#6945)

This commit is contained in:
Simon Frei 2020-08-30 08:03:10 +02:00 committed by GitHub
parent 44bf8cfd27
commit 540518a7b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,6 +78,9 @@ func (p *deviceFolderDownloadState) Update(updates []protocol.FileDownloadProgre
}
func (p *deviceFolderDownloadState) BytesDownloaded() int64 {
p.mut.RLock()
defer p.mut.RUnlock()
var res int64
for _, state := range p.files {
// BlockSize is a new field introduced in 1.4.1, thus a fallback