1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-11 05:43:23 +00:00

Check -files may download a chunk multple times

This commit fixed a bug that caused 'check -files' to download the same chunk
multiple times if shared by multiple small files.
This commit is contained in:
Gilbert Chen
2019-06-13 14:47:21 -04:00
parent 41668d4bbd
commit 4da7f7b6f9
2 changed files with 14 additions and 3 deletions

View File

@@ -1194,7 +1194,6 @@ func (manager *SnapshotManager) RetrieveFile(snapshot *Snapshot, file *Entry, ou
}
var chunk *Chunk
currentHash := ""
for i := file.StartChunk; i <= file.EndChunk; i++ {
start := 0
@@ -1207,10 +1206,12 @@ func (manager *SnapshotManager) RetrieveFile(snapshot *Snapshot, file *Entry, ou
}
hash := snapshot.ChunkHashes[i]
if currentHash != hash {
lastChunk, lastChunkHash := manager.chunkDownloader.GetLastDownloadedChunk()
if lastChunkHash != hash {
i := manager.chunkDownloader.AddChunk(hash)
chunk = manager.chunkDownloader.WaitForChunk(i)
currentHash = hash
} else {
chunk = lastChunk
}
output(chunk.GetBytes()[start:end])