Keep HTTP progress updated, and display a progress indicator during the
authorMichael Brown <mcb30@etherboot.org>
Mon, 29 Jan 2007 04:19:45 +0000 (04:19 +0000)
committerMichael Brown <mcb30@etherboot.org>
Mon, 29 Jan 2007 04:19:45 +0000 (04:19 +0000)
download

src/core/download.c
src/net/tcp/http.c
src/usr/imgmgmt.c

index bc89012..4522bf2 100644 (file)
@@ -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,
        },
 };
index 3293244..18030fe 100644 (file)
@@ -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 ) ) {
index 0d2c9cb..28801fe 100644 (file)
@@ -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 */