From 2a17d5bbfb1cde47af676f49f7409c7a0014758b Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 9 Nov 2023 11:56:09 +0100 Subject: just-mr archives fetch: Add logic for local mirrors and preferred hostnames --- src/other_tools/root_maps/content_git_map.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/other_tools/root_maps/content_git_map.cpp') diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp index a39b6cde..79500f5d 100644 --- a/src/other_tools/root_maps/content_git_map.cpp +++ b/src/other_tools/root_maps/content_git_map.cpp @@ -302,6 +302,7 @@ auto CreateContentGitMap( gsl::not_null const& content_cas_map, gsl::not_null const& import_to_git_map, LocalPathsPtr const& just_mr_paths, + MirrorsPtr const& additional_mirrors, CAInfoPtr const& ca_info, gsl::not_null const& resolve_symlinks_map, gsl::not_null const& critical_git_op_map, @@ -315,6 +316,7 @@ auto CreateContentGitMap( resolve_symlinks_map, critical_git_op_map, just_mr_paths, + additional_mirrors, ca_info, serve_api, local_api, @@ -505,6 +507,7 @@ auto CreateContentGitMap( sha256 = key.archive.sha256, sha512 = key.archive.sha512, pragma_special = key.pragma_special, + additional_mirrors, ca_info, origin = key.archive.origin, absent = key.absent, @@ -708,20 +711,12 @@ auto CreateContentGitMap( /*fatal=*/true); return; } - // now do the actual fetch; first, try the - // main fetch URL - auto data = - NetworkFetch(fetch_url, ca_info); - if (not data) { - // try the mirrors, in order, if given - for (auto const& mirror : mirrors) { - data = - NetworkFetch(mirror, ca_info); - if (data) { - break; - } - } - } + // now do the actual fetch + auto data = NetworkFetchWithMirrors( + fetch_url, + mirrors, + ca_info, + additional_mirrors); if (not data) { (*logger)( fmt::format("Failed to fetch a " -- cgit v1.2.3