diff mbox series

downloader: call postupdate after success

Message ID 1505837237-29305-1-git-send-email-sbabic@denx.de
State Accepted
Headers show
Series downloader: call postupdate after success | expand

Commit Message

Stefano Babic Sept. 19, 2017, 4:07 p.m. UTC
postupdate is not called by the downloader as it is done by suricatta
and by the Webserver.

Signed-off-by: Stefano Babic <sbabic@denx.de>
Reported-by: Florian Müller <mueller@mllapps.com>
---
 corelib/downloader.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Storm, Christian Sept. 20, 2017, 7:06 a.m. UTC | #1
Hi Stefano,

> postupdate is not called by the downloader as it is done by suricatta
> and by the Webserver.
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> Reported-by: Florian Müller <mueller@mllapps.com>
> ---
>  corelib/downloader.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/corelib/downloader.c b/corelib/downloader.c
> index b79d704..219a54c 100644
> --- a/corelib/downloader.c
> +++ b/corelib/downloader.c
> @@ -380,8 +380,15 @@ int start_download(const char *fname, int argc, char *argv[])
>  	for (attempt = 0;; attempt++) {
>  		result = download_from_url(options.url, options.retries,
>  						options.timeout);
> -		if (result != FAILURE)
> +		if (result != FAILURE) {
> +			ipc_message msg;
> +			if (ipc_postupdate(&msg) != 0) {
> +				result = FAILURE;
> +			} else {
> +				result = msg.type == ACK ? result : FAILURE;
> +			}
>  			break;
> +		}
>  
>  		if (options.retries > 0 && attempt >= options.retries)
>  			break;
> -- 
> 2.7.4
> 

Reviewed-by: Christian Storm <christian.storm@siemens.com>


Kind regards,
   Christian
diff mbox series

Patch

diff --git a/corelib/downloader.c b/corelib/downloader.c
index b79d704..219a54c 100644
--- a/corelib/downloader.c
+++ b/corelib/downloader.c
@@ -380,8 +380,15 @@  int start_download(const char *fname, int argc, char *argv[])
 	for (attempt = 0;; attempt++) {
 		result = download_from_url(options.url, options.retries,
 						options.timeout);
-		if (result != FAILURE)
+		if (result != FAILURE) {
+			ipc_message msg;
+			if (ipc_postupdate(&msg) != 0) {
+				result = FAILURE;
+			} else {
+				result = msg.type == ACK ? result : FAILURE;
+			}
 			break;
+		}
 
 		if (options.retries > 0 && attempt >= options.retries)
 			break;