index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2017-12-16 12:41:11 -0500 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2018-01-06 12:59:32 +1000 |
commit | 59bb21fce369e6453e00791cbb788e502e4039e9 (patch) | |
tree | cb1f006fc94e653464314dc678b0ffc6592d8dc4 /lib/libalpm | |
parent | d0981d4c5b59d724d9b7989b1083c2c0e9f839b2 (diff) |
-rw-r--r-- | lib/libalpm/dload.c | 9 | ||||
-rw-r--r-- | lib/libalpm/dload.h | 1 |
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 875b689c..44db5f88 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -133,11 +133,11 @@ static int dload_progress_cb(void *file, curl_off_t dltotal, curl_off_t dlnow, * 0, 0: non-download event * x {x>0}, x: download complete * x {x>0, x<y}, y {y > 0}: download progress, expected total is known */ - if(current_size == total_size) { - payload->handle->dlcb(payload->remote_name, dlnow, dltotal); - } else if(!payload->prevprogress) { + if(!payload->cb_initialized) { payload->handle->dlcb(payload->remote_name, 0, -1); - } else if(payload->prevprogress == current_size) { + payload->cb_initialized = 1; + } + if(payload->prevprogress == current_size) { payload->handle->dlcb(payload->remote_name, 0, 0); } else { /* do NOT include initial_size since it wasn't part of the package's @@ -732,6 +732,7 @@ void _alpm_dload_payload_reset_for_retry(struct dload_payload *payload) payload->initial_size += payload->prevprogress; payload->prevprogress = 0; payload->unlink_on_fail = 0; + payload->cb_initialized = 0; } /* vim: set noet: */ diff --git a/lib/libalpm/dload.h b/lib/libalpm/dload.h index 6ca775a7..ac948528 100644 --- a/lib/libalpm/dload.h +++ b/lib/libalpm/dload.h @@ -41,6 +41,7 @@ struct dload_payload { int errors_ok; int unlink_on_fail; int trust_remote_name; + int cb_initialized; #ifdef HAVE_LIBCURL CURLcode curlerr; /* last error produced by curl */ #endif |