summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2007-01-29 05:19:45 +0100
committerMichael Brown2007-01-29 05:19:45 +0100
commitbde8878eef55434428da0d8531c8c17d42867427 (patch)
tree381c5fca26b33c0e7a571c481de76f51140b4624
parentAdded async_block_progress() and default SIGUPDATE handler. (diff)
downloadipxe-bde8878eef55434428da0d8531c8c17d42867427.tar.gz
ipxe-bde8878eef55434428da0d8531c8c17d42867427.tar.xz
ipxe-bde8878eef55434428da0d8531c8c17d42867427.zip
Keep HTTP progress updated, and display a progress indicator during the
download
-rw-r--r--src/core/download.c3
-rw-r--r--src/net/tcp/http.c4
-rw-r--r--src/usr/imgmgmt.c7
3 files changed, 10 insertions, 4 deletions
diff --git a/src/core/download.c b/src/core/download.c
index bc890127..4522bf2c 100644
--- a/src/core/download.c
+++ b/src/core/download.c
@@ -170,6 +170,7 @@ static void download_reap ( struct async *async ) {
static struct async_operations download_async_operations = {
.reap = download_reap,
.signal = {
- [SIGCHLD] = download_sigchld,
+ [SIGCHLD] = download_sigchld,
+ [SIGUPDATE] = SIG_IGN,
},
};
diff --git a/src/net/tcp/http.c b/src/net/tcp/http.c
index 32932445..18030fe6 100644
--- a/src/net/tcp/http.c
+++ b/src/net/tcp/http.c
@@ -253,6 +253,10 @@ static void http_rx_data ( struct http_request *http,
return;
}
+ /* Update progress */
+ http->async.completed = http->buffer->fill;
+ http->async.total = http->content_length;
+
/* If we have reached the content-length, stop now */
if ( http->content_length &&
( http->buffer->fill >= http->content_length ) ) {
diff --git a/src/usr/imgmgmt.c b/src/usr/imgmgmt.c
index 0d2c9cb4..28801fe8 100644
--- a/src/usr/imgmgmt.c
+++ b/src/usr/imgmgmt.c
@@ -56,9 +56,10 @@ int imgfetch ( const char *uri_string, const char *name,
strncpy ( image->name, name, ( sizeof ( image->name ) - 1 ) );
/* Download the file */
- if ( ( rc = async_block ( &async, start_download ( uri_string, &async,
- &image->data,
- &image->len ))) !=0)
+ if ( ( rc = async_block_progress ( &async,
+ start_download ( uri_string, &async,
+ &image->data,
+ &image->len )))!=0)
goto err;
/* Register the image */