Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/dload.c
diff options
context:
space:
mode:
authorAnatol Pomozov <anatol.pomozov@gmail.com>2020-03-26 13:19:59 -0700
committerAllan McRae <allan@archlinux.org>2020-05-09 11:58:21 +1000
commita8a1a1bb3ec98a8471cb5cd13d096f39a267f789 (patch)
tree3a57e57e8dad88cc4bb51a0cd6b6d87d5a708b59 /lib/libalpm/dload.c
parentfe8e13341bdeae4a59c0270a632c29e71ae9deda (diff)
Introduce alpm_dbs_update() function for parallel db updates
This is an equivalent of alpm_db_update but for multiplexed (parallel) download. The difference is that this function accepts list of databases to update. And then ALPM internals download it in parallel if possible. Add a stub for _alpm_multi_download the function that will do parallel payloads downloads in the future. Introduce dload_payload->filepath field that contains url path to the file we download. It is like fileurl field but does not contain protocol/server part. The rationale for having this field is that with the curl multidownload the server retry logic is going to move to a curl callback. And the callback needs to be able to reconstruct the 'next' fileurl. One will be able to do it by getting the next server url from 'servers' list and then concat with filepath. Once the 'parallel download' refactoring is over 'fileurl' field will go away. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/dload.c')
-rw-r--r--lib/libalpm/dload.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 57232a53..8dc259f2 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -634,6 +634,16 @@ int _alpm_download(struct dload_payload *payload, const char *localpath,
}
}
+int _alpm_multi_download(alpm_handle_t *handle,
+ alpm_list_t *payloads /* struct dload_payload */,
+ const char *localpath)
+{
+ (void)handle;
+ (void)payloads;
+ (void)localpath;
+ return 0;
+}
+
static char *filecache_find_url(alpm_handle_t *handle, const char *url)
{
const char *filebase = strrchr(url, '/');
@@ -736,6 +746,7 @@ void _alpm_dload_payload_reset(struct dload_payload *payload)
FREE(payload->destfile_name);
FREE(payload->content_disp_name);
FREE(payload->fileurl);
+ FREE(payload->filepath);
*payload = (struct dload_payload){0};
}
@@ -744,6 +755,7 @@ void _alpm_dload_payload_reset_for_retry(struct dload_payload *payload)
ASSERT(payload, return);
FREE(payload->fileurl);
+ FREE(payload->filepath);
payload->initial_size += payload->prevprogress;
payload->prevprogress = 0;
payload->unlink_on_fail = 0;