Browse Source

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

Simon Frei 5 years ago
parent
commit
540518a7b7
1 changed files with 3 additions and 0 deletions
  1. 3 0
      lib/model/devicedownloadstate.go

+ 3 - 0
lib/model/devicedownloadstate.go

@@ -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