mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-10 13:23:17 +00:00
Fixed a bug that caused check -chunks -persist to succeed with broken chunks
The bug was not setting the `isBroken` flag in WaitForChunk()
This commit is contained in:
@@ -254,6 +254,9 @@ func (downloader *ChunkDownloader) WaitForChunk(chunkIndex int) (chunk *Chunk) {
|
|||||||
downloader.taskList[completion.chunkIndex].chunk = completion.chunk
|
downloader.taskList[completion.chunkIndex].chunk = completion.chunk
|
||||||
downloader.numberOfDownloadedChunks++
|
downloader.numberOfDownloadedChunks++
|
||||||
downloader.numberOfDownloadingChunks--
|
downloader.numberOfDownloadingChunks--
|
||||||
|
if completion.chunk.isBroken {
|
||||||
|
downloader.NumberOfFailedChunks++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return downloader.taskList[chunkIndex].chunk
|
return downloader.taskList[chunkIndex].chunk
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1041,6 +1041,9 @@ func (manager *SnapshotManager) CheckSnapshots(snapshotID string, revisionsToChe
|
|||||||
totalChunks := len(*allChunkHashes)
|
totalChunks := len(*allChunkHashes)
|
||||||
for i := 0; i < totalChunks; i++ {
|
for i := 0; i < totalChunks; i++ {
|
||||||
chunk := manager.chunkDownloader.WaitForChunk(i + chunkIndex)
|
chunk := manager.chunkDownloader.WaitForChunk(i + chunkIndex)
|
||||||
|
if chunk.isBroken {
|
||||||
|
continue
|
||||||
|
}
|
||||||
downloadedChunkSize += int64(chunk.GetLength())
|
downloadedChunkSize += int64(chunk.GetLength())
|
||||||
|
|
||||||
elapsedTime := time.Now().Sub(startTime).Seconds()
|
elapsedTime := time.Now().Sub(startTime).Seconds()
|
||||||
|
|||||||
Reference in New Issue
Block a user