mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
progress bar: always update when at 100%
Currently, the progress bar is updated at 5Hz. Because it is often not updated to 100% when the download is finished and curl exits, the bar is often "stuck" at 90-something, thus irritating the user. This patch fixes this by always updating the progress bar (instead of waiting for 200ms to have elapsed) while the download is finished but curl has not yet exited. This should not greatly affect performance because that moment is rather short. Signed-off-by: Tobias Markus <tobias@markus-regensburg.de>
This commit is contained in:
parent
e35ffda0b3
commit
93ca1d2065
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -55,16 +55,17 @@ int tool_progress_cb(void *clientp,
|
|||||||
curl_off_t total;
|
curl_off_t total;
|
||||||
curl_off_t point;
|
curl_off_t point;
|
||||||
|
|
||||||
if(bar->calls && (tvdiff(now, bar->prevtime) < 200L))
|
|
||||||
/* after first call, limit progress-bar updating to 5 Hz */
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* expected transfer size */
|
/* expected transfer size */
|
||||||
total = dltotal + ultotal + bar->initial_size;
|
total = dltotal + ultotal + bar->initial_size;
|
||||||
|
|
||||||
/* we've come this far */
|
/* we've come this far */
|
||||||
point = dlnow + ulnow + bar->initial_size;
|
point = dlnow + ulnow + bar->initial_size;
|
||||||
|
|
||||||
|
if(bar->calls && (tvdiff(now, bar->prevtime) < 200L) && point < total)
|
||||||
|
/* after first call, limit progress-bar updating to 5 Hz */
|
||||||
|
/* update when we're at 100% even if last update is less than 200ms ago */
|
||||||
|
return 0;
|
||||||
|
|
||||||
if(point > total)
|
if(point > total)
|
||||||
/* we have got more than the expected total! */
|
/* we have got more than the expected total! */
|
||||||
total = point;
|
total = point;
|
||||||
|
Loading…
Reference in New Issue
Block a user