diff --git a/include/downloader.h b/include/downloader.h index 6c2945d..6c0843f 100644 --- a/include/downloader.h +++ b/include/downloader.h @@ -61,6 +61,9 @@ struct xferInfo Timer timer; std::deque< std::pair > TimeAndSize; curl_off_t offset; + bool isChunk = false; + curl_off_t chunk_file_total = 0; + curl_off_t chunk_file_offset = 0; }; typedef struct diff --git a/src/downloader.cpp b/src/downloader.cpp index fe53b1c..486812c 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -3398,6 +3398,12 @@ int Downloader::progressCallbackForThread(void *clientp, curl_off_t dltotal, cur info.dltotal = dltotal; curl_off_t curl_rate; + if (xferinfo->isChunk) + { + info.dlnow += xferinfo->chunk_file_offset; + info.dltotal = xferinfo->chunk_file_total; + } + // trying to get rate and setting to NaN if it fails if (CURLE_OK != curl_easy_getinfo(xferinfo->curlhandle, CURLINFO_SPEED_DOWNLOAD_T, &curl_rate)) info.rate_avg = std::numeric_limits::quiet_NaN(); @@ -4159,6 +4165,10 @@ void Downloader::processGalaxyDownloadQueue(const std::string& install_path, Con std::vector cdnUrlTemplates; while (dlQueueGalaxy.try_pop(item)) { + xferinfo.isChunk = false; + xferinfo.chunk_file_offset = 0; + xferinfo.chunk_file_total = item.totalSizeCompressed; + if (item.product_id != prev_product_id) cdnUrlTemplates.clear(); @@ -4318,6 +4328,9 @@ void Downloader::processGalaxyDownloadQueue(const std::string& install_path, Con } for (unsigned int j = start_chunk; j < item.chunks.size(); ++j) { + xferinfo.isChunk = true; + xferinfo.chunk_file_offset = item.chunks[j].offset_compressed; // Set offset for progress info + // Refresh Galaxy login if token is expired if (galaxy->isTokenExpired()) {