diff options
author | Anatol Pomozov <anatol.pomozov@gmail.com> | 2020-03-08 21:33:32 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2020-05-09 03:58:21 +0200 |
commit | fe8e13341bdeae4a59c0270a632c29e71ae9deda (patch) | |
tree | 2e40d6b786ec2fe8bd5b878d09f2fa627c0190a8 /lib/libalpm/handle.c | |
parent | cffda331adca0aedd7c1fc17d739c27fc8041a20 (diff) | |
download | pacman-fe8e13341bdeae4a59c0270a632c29e71ae9deda.tar.gz pacman-fe8e13341bdeae4a59c0270a632c29e71ae9deda.tar.xz |
Add config option to specify amount of parallel download streams
It includes pacman.conf new 'ParallelDownloads' option that
specifies how many concurrent downloads cURL starts in parallel.
Add alpm_option_set_parallel_downloads() ALPM function that
allows to set this config option programmatically.
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r-- | lib/libalpm/handle.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 6b19a703..e3b2c911 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -856,3 +856,18 @@ int SYMEXPORT alpm_option_set_disable_dl_timeout(alpm_handle_t *handle, #endif return 0; } + +int SYMEXPORT alpm_option_set_parallel_downloads(alpm_handle_t *handle, + unsigned int num_streams) +{ + CHECK_HANDLE(handle, return -1); +#ifdef HAVE_LIBCURL + if(num_streams < 1) { + return -1; + } + handle->parallel_downloads = num_streams; +#else + (void)num_streams; /* silence unused variable warnings */ +#endif + return 0; +} |