ソースを参照

[downloader] Allow underlying downloads to provide detailed job progress

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 6年前
コミット
a258b0897b
1個のファイルの変更9行の追加2行の削除
  1. 9
    2
      src/core/downloader.c

+ 9
- 2
src/core/downloader.c ファイルの表示

111
  */
111
  */
112
 static int downloader_progress ( struct downloader *downloader,
112
 static int downloader_progress ( struct downloader *downloader,
113
 				 struct job_progress *progress ) {
113
 				 struct job_progress *progress ) {
114
+	int rc;
115
+
116
+	/* Allow data transfer to provide an accurate description */
117
+	if ( ( rc = job_progress ( &downloader->xfer, progress ) ) != 0 )
118
+		return rc;
114
 
119
 
115
 	/* This is not entirely accurate, since downloaded data may
120
 	/* This is not entirely accurate, since downloaded data may
116
 	 * arrive out of order (e.g. with multicast protocols), but
121
 	 * arrive out of order (e.g. with multicast protocols), but
117
 	 * it's a reasonable first approximation.
122
 	 * it's a reasonable first approximation.
118
 	 */
123
 	 */
119
-	progress->completed = downloader->buffer.pos;
120
-	progress->total = downloader->buffer.len;
124
+	if ( ! progress->total ) {
125
+		progress->completed = downloader->buffer.pos;
126
+		progress->total = downloader->buffer.len;
127
+	}
121
 
128
 
122
 	return 0;
129
 	return 0;
123
 }
130
 }

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