diff options
author | Michael Brown <mcb30@ipxe.org> | 2017-09-05 22:53:49 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2017-09-05 23:23:22 +0100 |
commit | a258b0897b0560cdf123c79687e84141af9d3ff5 (patch) | |
tree | 91c76619563be0f9d2debbc2798b3ebcdac2eb8b /src/core | |
parent | e30cc5e9e5fc0aed7c30245daab1e922a90460c0 (diff) | |
download | ipxe-a258b0897b0560cdf123c79687e84141af9d3ff5.zip ipxe-a258b0897b0560cdf123c79687e84141af9d3ff5.tar.gz ipxe-a258b0897b0560cdf123c79687e84141af9d3ff5.tar.bz2 |
[downloader] Allow underlying downloads to provide detailed job progress
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/downloader.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/downloader.c b/src/core/downloader.c index 35b5b0a..33737bf 100644 --- a/src/core/downloader.c +++ b/src/core/downloader.c @@ -111,13 +111,20 @@ static void downloader_finished ( struct downloader *downloader, int rc ) { */ static int downloader_progress ( struct downloader *downloader, 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 * arrive out of order (e.g. with multicast protocols), but * it's a reasonable first approximation. */ - progress->completed = downloader->buffer.pos; - progress->total = downloader->buffer.len; + if ( ! progress->total ) { + progress->completed = downloader->buffer.pos; + progress->total = downloader->buffer.len; + } return 0; } |