From 65ae7f12aee101a705ff7fbd0f3be36bbaf9792c Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 25 Aug 2026 23:28:32 +0100 Subject: [PATCH] Report progress for transfers with no announced length (#71) Rapid's streamer.cgi sends no Content-Length, so percentage stays at zero for the whole transfer and every progress line after the first was dropped. Compare the byte count as well, so an unsized transfer still reports what has arrived. --- src/Logger.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Logger.cpp b/src/Logger.cpp index e2be1042..48fd90e6 100644 --- a/src/Logger.cpp +++ b/src/Logger.cpp @@ -92,7 +92,8 @@ extern void L_LOG(const char* fileName, int line, const char* funName, L_LEVEL l extern void LOG_PROGRESS(int64_t done, int64_t total, bool forceOutput) { static std::chrono::steady_clock::time_point lastlogtime; - static double lastPercentage = 0.0f; + static int64_t lastDone = -1; + static int64_t lastTotal = -1; if (!logEnabled) { return; @@ -106,15 +107,16 @@ extern void LOG_PROGRESS(int64_t done, int64_t total, bool forceOutput) return; } + if (done == lastDone && total == lastTotal) + return; + lastDone = done; + lastTotal = total; + double percentage = 0; if (total > 0) { percentage = static_cast(done) / static_cast(total); } - if (percentage == lastPercentage) - return; - lastPercentage = percentage; - // In case the toal/done are incorrect, put 50% if (percentage < 0 || percentage > 1) { percentage = 0.5;