Bläddra i källkod

Keep HTTP progress updated, and display a progress indicator during the

download
tags/v0.9.3
Michael Brown 18 år sedan
förälder
incheckning
bde8878eef
3 ändrade filer med 10 tillägg och 4 borttagningar
  1. 2
    1
      src/core/download.c
  2. 4
    0
      src/net/tcp/http.c
  3. 4
    3
      src/usr/imgmgmt.c

+ 2
- 1
src/core/download.c Visa fil

@@ -170,6 +170,7 @@ static void download_reap ( struct async *async ) {
170 170
 static struct async_operations download_async_operations = {
171 171
 	.reap = download_reap,
172 172
 	.signal = {
173
-		[SIGCHLD] = download_sigchld,
173
+		[SIGCHLD]	= download_sigchld,
174
+		[SIGUPDATE]	= SIG_IGN,
174 175
 	},
175 176
 };

+ 4
- 0
src/net/tcp/http.c Visa fil

@@ -253,6 +253,10 @@ static void http_rx_data ( struct http_request *http,
253 253
 		return;
254 254
 	}
255 255
 
256
+	/* Update progress */
257
+	http->async.completed = http->buffer->fill;
258
+	http->async.total = http->content_length;
259
+
256 260
 	/* If we have reached the content-length, stop now */
257 261
 	if ( http->content_length &&
258 262
 	     ( http->buffer->fill >= http->content_length ) ) {

+ 4
- 3
src/usr/imgmgmt.c Visa fil

@@ -56,9 +56,10 @@ int imgfetch ( const char *uri_string, const char *name,
56 56
 		strncpy ( image->name, name, ( sizeof ( image->name ) - 1 ) );
57 57
 
58 58
 	/* Download the file */
59
-	if ( ( rc = async_block ( &async, start_download ( uri_string, &async,
60
-							   &image->data,
61
-							   &image->len ))) !=0)
59
+	if ( ( rc = async_block_progress ( &async,
60
+					   start_download ( uri_string, &async,
61
+							    &image->data,
62
+							    &image->len )))!=0)
62 63
 		goto err;
63 64
 
64 65
 	/* Register the image */

Laddar…
Avbryt
Spara