diff options
| author | Dan Engelbrecht <[email protected]> | 2025-02-28 12:39:48 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-02-28 12:39:48 +0100 |
| commit | 5791f51cccea1d4e5365456c8da89dbac0dd3ec0 (patch) | |
| tree | 137412a5e731a4ac33b53b0f0d33b39b29975a03 /src/zenutil/chunkedfile.cpp | |
| parent | 5.5.20 (diff) | |
| download | zen-5791f51cccea1d4e5365456c8da89dbac0dd3ec0.tar.xz zen-5791f51cccea1d4e5365456c8da89dbac0dd3ec0.zip | |
improve error handling (#289)
* clearer errors
* quicker abort
* handle deleted local files
* simplify parallellwork error handling
* don't finish progress on destructor - gives wrong impression
* graceful ctrl-c handling
Diffstat (limited to 'src/zenutil/chunkedfile.cpp')
| -rw-r--r-- | src/zenutil/chunkedfile.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/zenutil/chunkedfile.cpp b/src/zenutil/chunkedfile.cpp index 3f3a6661c..4f9344039 100644 --- a/src/zenutil/chunkedfile.cpp +++ b/src/zenutil/chunkedfile.cpp @@ -112,7 +112,12 @@ Reconstruct(const ChunkedInfo& Info, const std::filesystem::path& TargetPath, st } ChunkedInfoWithSource -ChunkData(BasicFile& RawData, uint64_t Offset, uint64_t Size, ChunkedParams Params, std::atomic<uint64_t>* BytesProcessed) +ChunkData(BasicFile& RawData, + uint64_t Offset, + uint64_t Size, + ChunkedParams Params, + std::atomic<uint64_t>* BytesProcessed, + std::atomic<bool>* AbortFlag) { ChunkedInfoWithSource Result; tsl::robin_map<IoHash, uint32_t, IoHash::Hasher> FoundChunks; @@ -129,6 +134,10 @@ ChunkData(BasicFile& RawData, uint64_t Offset, uint64_t Size, ChunkedParams Para IoHashStream RawHashStream; while (Offset < End) { + if (AbortFlag != nullptr && AbortFlag->load()) + { + return {}; + } size_t ScanLength = Chunker.ScanChunk(SliceView.GetData(), SliceSize); if (ScanLength == ZenChunkHelper::kNoBoundaryFound) { |