mirror of https://github.com/ipxe/ipxe.git
[downloader] Allow underlying downloads to provide detailed job progress
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/66/head
parent
e30cc5e9e5
commit
a258b0897b
|
@ -111,13 +111,20 @@ static void downloader_finished ( struct downloader *downloader, int rc ) {
|
||||||
*/
|
*/
|
||||||
static int downloader_progress ( struct downloader *downloader,
|
static int downloader_progress ( struct downloader *downloader,
|
||||||
struct job_progress *progress ) {
|
struct job_progress *progress ) {
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
/* Allow data transfer to provide an accurate description */
|
||||||
|
if ( ( rc = job_progress ( &downloader->xfer, progress ) ) != 0 )
|
||||||
|
return rc;
|
||||||
|
|
||||||
/* This is not entirely accurate, since downloaded data may
|
/* This is not entirely accurate, since downloaded data may
|
||||||
* arrive out of order (e.g. with multicast protocols), but
|
* arrive out of order (e.g. with multicast protocols), but
|
||||||
* it's a reasonable first approximation.
|
* it's a reasonable first approximation.
|
||||||
*/
|
*/
|
||||||
progress->completed = downloader->buffer.pos;
|
if ( ! progress->total ) {
|
||||||
progress->total = downloader->buffer.len;
|
progress->completed = downloader->buffer.pos;
|
||||||
|
progress->total = downloader->buffer.len;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue