ソースを参照

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

download
tags/v0.9.3
Michael Brown 18年前
コミット
bde8878eef
3個のファイルの変更10行の追加4行の削除
  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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 */

読み込み中…
キャンセル
保存