[LEDE-DEV] [PATCH][opkg] add opkg option http_timeout

John Crispin john at phrozen.org
Tue Dec 12 02:16:01 PST 2017


Hi Lynxis,

patch is missing the SoB line. please fix/resend

     John


On 04/12/17 17:48, Alexander Couzens wrote:
> http_timeout will append `--timeout xy` to the resulting wget
> call. This is useful when using opkg update in a automatic
> way and prevent long timeouts
> ---
>   libopkg/opkg_conf.c     | 1 +
>   libopkg/opkg_conf.h     | 1 +
>   libopkg/opkg_download.c | 6 +++++-
>   3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
> index bab8f573b661..08855ebcd3d8 100644
> --- a/libopkg/opkg_conf.c
> +++ b/libopkg/opkg_conf.c
> @@ -57,6 +57,7 @@ opkg_option_t options[] = {
>   	{"no_check_certificate", OPKG_OPT_TYPE_BOOL, &_conf.no_check_certificate},
>   	{"ftp_proxy", OPKG_OPT_TYPE_STRING, &_conf.ftp_proxy},
>   	{"http_proxy", OPKG_OPT_TYPE_STRING, &_conf.http_proxy},
> +	{"http_timeout", OPKG_OPT_TYPE_STRING, &_conf.http_timeout},
>   	{"no_proxy", OPKG_OPT_TYPE_STRING, &_conf.no_proxy},
>   	{"test", OPKG_OPT_TYPE_BOOL, &_conf.noaction},
>   	{"noaction", OPKG_OPT_TYPE_BOOL, &_conf.noaction},
> diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h
> index b63a1e6fdf72..37f95a1a9935 100644
> --- a/libopkg/opkg_conf.h
> +++ b/libopkg/opkg_conf.h
> @@ -92,6 +92,7 @@ struct opkg_conf {
>   
>   	/* proxy options */
>   	char *http_proxy;
> +	char *http_timeout;
>   	char *ftp_proxy;
>   	char *no_proxy;
>   	char *proxy_user;
> diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c
> index 36db231f30f5..ba034e8f8bd4 100644
> --- a/libopkg/opkg_download.c
> +++ b/libopkg/opkg_download.c
> @@ -87,7 +87,7 @@ opkg_download(const char *src, const char *dest_file_name,
>   
>   	{
>   		int res;
> -		const char *argv[9];
> +		const char *argv[11];
>   		int i = 0;
>   
>   		argv[i++] = "wget";
> @@ -95,6 +95,10 @@ opkg_download(const char *src, const char *dest_file_name,
>   		if (conf->no_check_certificate) {
>   			argv[i++] = "--no-check-certificate";
>   		}
> +		if (conf->http_timeout) {
> +			argv[i++] = "--timeout";
> +			argv[i++] = conf->http_timeout;
> +		}
>   		if (conf->http_proxy || conf->ftp_proxy) {
>   			argv[i++] = "-Y";
>   			argv[i++] = "on";




More information about the Lede-dev mailing list