diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/alpm.h | 9 | ||||
-rw-r--r-- | lib/libalpm/handle.c | 15 | ||||
-rw-r--r-- | lib/libalpm/handle.h | 1 |
3 files changed, 25 insertions, 0 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index c2a069ad..5d559db1 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -903,6 +903,15 @@ int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, int level); int alpm_option_set_disable_dl_timeout(alpm_handle_t *handle, unsigned short disable_dl_timeout); +/** Sets number of parallel streams to download database and package files. + * If the function is not called then the default value of '1' stream + * (i.e. sequential download) is used. + * @param handle the context handle + * @param num_streams number of parallel download streams + * @return 0 on success, -1 on error + */ +int alpm_option_set_parallel_downloads(alpm_handle_t *handle, unsigned int num_streams); + /** @} */ /** @addtogroup alpm_api_databases Database Functions 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; +} diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index c343f6e0..cd7104f9 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -61,6 +61,7 @@ struct __alpm_handle_t { /* libcurl handle */ CURL *curl; /* reusable curl_easy handle */ unsigned short disable_dl_timeout; + unsigned int parallel_downloads; /* number of download streams */ #endif #ifdef HAVE_LIBGPGME |