From 994d87c7f281e6cef34c00e97fe751ece8b9ae4d Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Thu, 30 May 2024 17:20:06 +0900 Subject: [PATCH] downloader: allow common channel settings The previous patch added max-download-speed so just add this one to the config example, but using channel_settings() gets a few others for free if someone ever requires setting them. Signed-off-by: Dominique Martinet Acked-by: Stefano Babic --- corelib/downloader.c | 3 +-- examples/configuration/swupdate.cfg | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/corelib/downloader.c b/corelib/downloader.c index 1ca530ea..5e1006bc 100644 --- a/corelib/downloader.c +++ b/corelib/downloader.c @@ -109,10 +109,9 @@ static int download_settings(void *elem, void __attribute__ ((__unused__)) *dat GET_FIELD_INT(LIBCFG_PARSER, elem, "retries", &opt->retries); - GET_FIELD_INT(LIBCFG_PARSER, elem, "retrywait", - &opt->retry_sleep); GET_FIELD_INT(LIBCFG_PARSER, elem, "timeout", &opt->low_speed_timeout); + channel_settings(elem, &channel_options); return 0; } diff --git a/examples/configuration/swupdate.cfg b/examples/configuration/swupdate.cfg index 69a57e61..2702396d 100644 --- a/examples/configuration/swupdate.cfg +++ b/examples/configuration/swupdate.cfg @@ -105,11 +105,15 @@ logcolors : { # authentication : string # credentials needed to get software if server # enables Basic Auth to allow this downloading +# max-download-speed : string +# Specify maximum download speed to use. Value can be expressed as +# B/s, kB/s, M/s, G/s. Example: 512k download : { authentication = "user:password"; retries = 3; timeout = 1800; + max-download-speed = "1M"; retrywait = 5; url = "http://example.com/software.swu"; userid = 1000;