summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorMartin Kühne <mysatyre@gmail.com>2016-10-17 16:40:37 +0200
committerAllan McRae <allan@archlinux.org>2016-12-05 06:20:08 +0100
commite83e868a77865d42a33076605f9a90a165f7c93a (patch)
tree0b3ccebe37ae4474b850397f243e31a6b546b722 /lib/libalpm/sync.c
parentc3b954e7b93140aa85559fa350582160f3c0a72b (diff)
downloadpacman-e83e868a77865d42a33076605f9a90a165f7c93a.tar.gz
pacman-e83e868a77865d42a33076605f9a90a165f7c93a.tar.xz
Parametrise the different ways in which the payload is reset
In FS#43434, Downloads which fail and are restarted on a different server will resume and may display a negative download speed. The payload's progress in libalpm was not properly reset which ultimately caused terminal noise because the line width calculation assumes positive download speeds. This patch fixes the incomplete reset of the payload by mimicing what be_sync.c:alpm_db_update() does over in sync.c:download_single_file(). The new dload.c:_alpm_dload_payload_reset_for_retry() extends beyond the current behavior by updating initial_size and prevprogress for this case. This makes pacman reset the progress properly in the next invocation of the callback and display positive download speeds. Fixes FS#43434. Signed-off-by: Martin Kühne <mysatyre@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 837639d4..d3be09e4 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -946,9 +946,7 @@ static int download_single_file(alpm_handle_t *handle, struct dload_payload *pay
EVENT(handle, &event);
return 0;
}
-
- FREE(payload->fileurl);
- payload->unlink_on_fail = 0;
+ _alpm_dload_payload_reset_for_retry(payload);
}
event.type = ALPM_EVENT_PKGDOWNLOAD_FAILED;