summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCherish98 <66007047+Cherish98@users.noreply.github.com>2021-04-02 10:57:38 +0000
committerJay Satiro <raysatiro@yahoo.com>2021-04-05 23:43:26 -0400
commit4b4401e26acd3a181706e890402ffb371899df2b (patch)
tree7dedbfe1cfe0349f353bd6602e27bb909932986f /src
parentc1abc6624d8fb1bd2286feeb8b623dd4850fadbe (diff)
downloadcurl-4b4401e26acd3a181706e890402ffb371899df2b.tar.gz
tool_progress: Fix progress meter in parallel mode
Make sure the total amount of DL/UL bytes are counted before the transfer finalizes. Otherwise if a transfer finishes too quick, its total numbers are not added, and results in a DL%/UL% that goes above 100%. Detail: progress_meter() is called periodically, and it may not catch a transfer's total bytes if the value was unknown during the last call, and the transfer is finished and deleted (i.e., lost) during the next call. Closes https://github.com/curl/curl/pull/6840
Diffstat (limited to 'src')
-rw-r--r--src/tool_progress.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tool_progress.c b/src/tool_progress.c
index 7db6df909..da6c2bc6f 100644
--- a/src/tool_progress.c
+++ b/src/tool_progress.c
@@ -318,4 +318,12 @@ void progress_finalize(struct per_transfer *per)
/* get the numbers before this transfer goes away */
all_dlalready += per->dlnow;
all_ulalready += per->ulnow;
+ if(!per->dltotal_added) {
+ all_dltotal += per->dltotal;
+ per->dltotal_added = TRUE;
+ }
+ if(!per->ultotal_added) {
+ all_ultotal += per->ultotal;
+ per->ultotal_added = TRUE;
+ }
}