[pacman-dev] [PATCH 1/1] add command line options for libcurl's "low speed" timeout

brainpower brainpower at mailbox.org
Sun Nov 13 23:33:24 UTC 2016


Hi,

On 30.08.2016 15:16, Christian Hesse wrote:
> From: Christian Hesse <mail at eworm.de>
> 
> Signed-off-by: Christian Hesse <mail at eworm.de>
> ---
>  doc/pacman.8.txt    | 13 +++++++++++++
>  src/pacman/conf.h   |  4 +++-
>  src/pacman/pacman.c | 14 ++++++++++++++
>  3 files changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt
> index 231e0bc..83f63e6 100644
> --- a/doc/pacman.8.txt
> +++ b/doc/pacman.8.txt
> @@ -266,6 +266,19 @@ Upgrade Options (apply to '-S' and '-U')[[UO]]
>  *\--needed*::
>  	Do not reinstall the targets that are already up-to-date.
>  
> +*\--lowspeedlimit* <speed>::
> +    Sets the speed in bytes per second that a download should be below during
> +    `LowSpeedTime` seconds to abort the transfer for being too slow. Setting
> +    'speed' to 0 will disable the speed check. Defaults to 1 byte per second.
> +    Note that this option will not affect external programs specified by
> +    `XferCommand`.
> +
> +*\--lowspeedlimit* <time>::

'--lowspeedlimit' is used a second time here.
Probably a copy-paste error and meant to be '--lowspeedtime'?

> +    Sets the time in seconds that a download should be below the `LowSpeedLimit`
> +    transfer speed to abort the transfer for being too slow. Setting 'time' to
> +    0 will disable the speed check. Defaults to 10 seconds. Note that this
> +    option will not affect external programs specified by `XferCommand`.
> +
>  
>  Query Options (apply to '-Q')[[QO]]
>  -----------------------------------
> diff --git a/src/pacman/conf.h b/src/pacman/conf.h
> index c61ed2a..fe296cc 100644
> --- a/src/pacman/conf.h
> +++ b/src/pacman/conf.h
> @@ -205,7 +205,9 @@ enum {
>  	OP_VERBOSE,
>  	OP_DOWNLOADONLY,
>  	OP_REFRESH,
> -	OP_ASSUMEINSTALLED
> +	OP_ASSUMEINSTALLED,
> +	OP_LOWSPEEDLIMIT,
> +	OP_LOWSPEEDTIME
>  };
>  
>  /* clean method */
> diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
> index be52d1b..f6a5f33 100644
> --- a/src/pacman/pacman.c
> +++ b/src/pacman/pacman.c
> @@ -194,6 +194,12 @@ static void usage(int op, const char * const myname)
>  				addlist(_("      --ignore <pkg>   ignore a package upgrade (can be used more than once)\n"));
>  				addlist(_("      --ignoregroup <grp>\n"
>  				          "                       ignore a group upgrade (can be used more than once)\n"));
> +#ifdef HAVE_LIBCURL
> +				addlist(_("      --lowspeedlimit <speed>\n"
> +				          "                       bytes per second that a download should be below\n"));
> +				addlist(_("      --lowspeedtime <time>\n"
> +				          "                       time in seconds that a download should be below lowspeedlimit\n"));
> +#endif
>  				/* pass through */
>  			case PM_OP_REMOVE:
>  				addlist(_("  -d, --nodeps         skip dependency version checks (-dd to skip all checks)\n"));
> @@ -713,6 +719,12 @@ static int parsearg_upgrade(int opt)
>  		case OP_IGNOREGROUP:
>  			parsearg_util_addlist(&(config->ignoregrp));
>  			break;
> +		case OP_LOWSPEEDLIMIT:
> +			config->lowspeedlimit = parse_positive_long(optarg);
> +			break;
> +		case OP_LOWSPEEDTIME:
> +			config->lowspeedtime = parse_positive_long(optarg);
> +			break;
>  		default: return 1;
>  	}
>  	return 0;
> @@ -928,6 +940,8 @@ static int parseargs(int argc, char *argv[])
>  		{"logfile",    required_argument, 0, OP_LOGFILE},
>  		{"ignoregroup", required_argument, 0, OP_IGNOREGROUP},
>  		{"needed",     no_argument,       0, OP_NEEDED},
> +		{"lowspeedlimit", required_argument, 0, OP_LOWSPEEDLIMIT},
> +		{"lowspeedtime", required_argument, 0, OP_LOWSPEEDTIME},
>  		{"asexplicit",     no_argument,   0, OP_ASEXPLICIT},
>  		{"arch",       required_argument, 0, OP_ARCH},
>  		{"print-format", required_argument, 0, OP_PRINTFORMAT},
> 

-- 
regards,
brainpower

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20161114/b8571ea2/attachment.asc>


More information about the pacman-dev mailing list