From cb86917184f4e1aa23e9157a5b59d15aa1c3e1c5 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Thu, 31 Dec 2015 06:41:57 +0200 Subject: Prefer http mirrors when using a mirrorlist Sort http mirrors to the beginning of the mirror list. This avoids an rsync mirror being selected as the mirror sometimes, which causes the preferred aria2 downloader from not being used. This also has the effect that in practice aria2 will only be given http mirrors. If this causes issues, the sorting code can be changed to reverse sort with the presence of "rsync://" instead. --- NEWS | 3 +++ urpm/mirrors.pm | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index aa6a9f4c..45512c39 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +- prefer http mirrors when using a mirrorlist, this avoids selecting an rsync + mirror which prevents aria2 from being used + Version 8.10 - 9 October 2015 - fix urpm::bug_report (mga#16925) diff --git a/urpm/mirrors.pm b/urpm/mirrors.pm index 295c92c6..888c411e 100644 --- a/urpm/mirrors.pm +++ b/urpm/mirrors.pm @@ -276,7 +276,9 @@ sub add_proximity_and_sort { $_->{proximity_corrected} *= _between_country_correction($country_code, $_->{country}) if $best; $_->{proximity_corrected} *= _between_continent_correction($best->{continent}, $_->{continent}) if $best; } - @$mirrors = sort { $a->{proximity_corrected} <=> $b->{proximity_corrected} } @$mirrors; + # prefer http mirrors by sorting them to the beginning + @$mirrors = sort { ($b->{url} =~ m!^http://!) <=> ($a->{url} =~ m!^http://!) + || $a->{proximity_corrected} <=> $b->{proximity_corrected} } @$mirrors; } # add +/- 5% random -- cgit v1.2.1