Welcome to the Pacman bug tracker. Please search the current bugs and feature requests before filing a new one! Use advanced search and select "Search in Comments".

* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproducible test case whenever possible.

FS#21853 - cb_dl_progress cannot be initialized properly when resuming a file

Attached to Project: Pacman
Opened by Xavier (shining) - Saturday, 27 November 2010, 15:04 GMT
Last edited by Allan McRae (Allan) - Friday, 12 February 2016, 12:54 GMT
Task Type Bug Report
Category General
Status Assigned
Assigned To Allan McRae (Allan)
Dave Reisner (falconindy)
Architecture All
Severity Low
Priority Normal
Reported Version 3.4.1
Due in Version 5.1.0
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


dload.c does
handle->dlcb(filename, 0, ust.size);
even when we are resuming a file at a given offset, because that's the only way to tell cb_dl_progress to re-initialize its counters when we are starting a file download.

There are probably many ways to fix this, just unsure which one to choose :
1) track last filename in cb_dl_progress to detect new files and reset counters
2) add a parameter or abuse existing parameters (e.g. filename == NULL) to tell cb_dl_progress to reset
3) add a new callback function to reset or init a new file download at a given offset
This task depends upon

Comment by Dan McGee (toofishes) - Saturday, 27 November 2010, 18:01 GMT
I've noticed this before as well, but never felt motivated to look into it. It messes up the averages we calculate at the end as well.
Comment by Xavier (shining) - Saturday, 27 November 2010, 18:28 GMT
Yeah I know, I just spotted it again today and it pissed me off.
I wanted to go ahead and fix it but I hesitated a bit on which way to go. So instead I put it there to record it.
So feedback welcome :) (1, 2 or 3)
Comment by Xavier (shining) - Tuesday, 01 February 2011, 09:36 GMT
toofishes >> shining^: part of me says the callback itself shouldn't have to track/figure out so much
toofishes >> just have it get passed a shitload of info
toofishes >> the rates and all would get calced in the backend
Comment by Allan McRae (Allan) - Sunday, 22 April 2012, 11:21 GMT
@Dave: I seem to remember this being fixed in all your downloader work. Confirm/deny?
Comment by Dave Reisner (falconindy) - Sunday, 22 April 2012, 13:17 GMT
Nope, not yet.