mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[core] Use dynamic chunk size for downloading maps
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
dee47e7a66
commit
1becd3e0ba
@@ -136,7 +136,6 @@ class FileHttpRequest : public HttpRequest, public IHttpThreadCallback
|
||||
string m_filePath;
|
||||
unique_ptr<FileWriter> m_writer;
|
||||
|
||||
size_t m_goodChunksCount;
|
||||
bool m_doCleanProgressFiles;
|
||||
|
||||
// Starts a thread per each free/available server.
|
||||
@@ -248,13 +247,9 @@ class FileHttpRequest : public HttpRequest, public IHttpThreadCallback
|
||||
else if (result == ChunksDownloadStrategy::EDownloadSucceeded)
|
||||
m_status = DownloadStatus::Completed;
|
||||
|
||||
if (isChunkOk)
|
||||
{
|
||||
// save information for download resume
|
||||
++m_goodChunksCount;
|
||||
if (m_status != DownloadStatus::Completed && m_goodChunksCount % 10 == 0)
|
||||
SaveResumeChunks();
|
||||
}
|
||||
// Save chunks statuses into the resume file.
|
||||
if (isChunkOk && m_status != DownloadStatus::Completed)
|
||||
SaveResumeChunks();
|
||||
|
||||
if (m_status == DownloadStatus::InProgress)
|
||||
return;
|
||||
@@ -300,7 +295,7 @@ public:
|
||||
int64_t chunkSize, bool doCleanProgressFiles)
|
||||
: HttpRequest(std::move(onFinish), std::move(onProgress)),
|
||||
m_strategy(urls), m_filePath(filePath),
|
||||
m_goodChunksCount(0), m_doCleanProgressFiles(doCleanProgressFiles)
|
||||
m_doCleanProgressFiles(doCleanProgressFiles)
|
||||
{
|
||||
ASSERT ( !urls.empty(), () );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user