[pacman-dev] [PATCH] Resume downloads properly on another server

Martin Kühne mysatyre at gmail.com
Tue Oct 11 17:10:30 UTC 2016


Package Downloads which fail for the next mirror to be used may resume and
display negative download speeds. A detailed analysis revealed that the
payload's progress in libalpm is not properly reset which ultimately leads to
this annoying terminal noise due to a negative sign on the download speeds.

This patch resets the payload's prevprogress so that the callback's state
is properly reset.

Fixes the beautifully symmetric FS#43434

Signed-off-by: Martin Kühne <mysatyre at gmail.com>
---
 lib/libalpm/dload.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index dc57c92..657f562 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -605,6 +605,9 @@ cleanup:
 			STRDUP(*final_file, strrchr(realname, '/') + 1,
 					RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 		}
+	} else {
+		payload->initial_size += payload->prevprogress;
+		payload->prevprogress = 0;
 	}
 
 	if((ret == -1 || dload_interrupted) && payload->unlink_on_fail &&
-- 
2.10.0


More information about the pacman-dev mailing list