1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-06 00:03:38 +00:00

Don't add corrupt chunks to verified_chunks

When -persist is specified, the chunk downloader may return the chunk even if
the chunk is corrupt.  We use the chunk.isBroken flag to detect this situation.
This commit is contained in:
Gilbert Chen
2024-07-10 10:32:40 -04:00
parent 0d3ee4186c
commit b659456f12

View File

@@ -1083,6 +1083,8 @@ func (manager *SnapshotManager) CheckSnapshots(snapshotID string, revisionsToChe
if chunk == nil { if chunk == nil {
continue continue
} }
if !chunk.isBroken {
chunkID := manager.config.GetChunkIDFromHash(chunkHashes[chunkIndex]) chunkID := manager.config.GetChunkIDFromHash(chunkHashes[chunkIndex])
verifiedChunksLock.Lock() verifiedChunksLock.Lock()
verifiedChunks[chunkID] = startTime.Unix() verifiedChunks[chunkID] = startTime.Unix()
@@ -1097,6 +1099,7 @@ func (manager *SnapshotManager) CheckSnapshots(snapshotID string, revisionsToChe
percentage := float64(downloadedChunks) / float64(totalChunks) * 100.0 percentage := float64(downloadedChunks) / float64(totalChunks) * 100.0
LOG_INFO("VERIFY_PROGRESS", "Verified chunk %s (%d/%d), %sB/s %s %.1f%%", LOG_INFO("VERIFY_PROGRESS", "Verified chunk %s (%d/%d), %sB/s %s %.1f%%",
chunkID, downloadedChunks, totalChunks, PrettySize(speed), PrettyTime(remainingTime), percentage) chunkID, downloadedChunks, totalChunks, PrettySize(speed), PrettyTime(remainingTime), percentage)
}
manager.config.PutChunk(chunk) manager.config.PutChunk(chunk)
} }