summaryrefslogtreecommitdiffstats
path: root/urpm/mirrors.pm
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@mageia.org>2015-12-31 06:41:57 +0200
committerAnssi Hannula <anssi@mageia.org>2015-12-31 06:41:57 +0200
commitcb86917184f4e1aa23e9157a5b59d15aa1c3e1c5 (patch)
tree118f389e2bc6e150c17be48f7cc4249c69dba6e9 /urpm/mirrors.pm
parent38d44bdc0e63e5b647f4fd0f705b8d1c1babce27 (diff)
downloadurpmi-cb86917184f4e1aa23e9157a5b59d15aa1c3e1c5.tar
urpmi-cb86917184f4e1aa23e9157a5b59d15aa1c3e1c5.tar.gz
urpmi-cb86917184f4e1aa23e9157a5b59d15aa1c3e1c5.tar.bz2
urpmi-cb86917184f4e1aa23e9157a5b59d15aa1c3e1c5.tar.xz
urpmi-cb86917184f4e1aa23e9157a5b59d15aa1c3e1c5.zip
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.
Diffstat (limited to 'urpm/mirrors.pm')
-rw-r--r--urpm/mirrors.pm4
1 files changed, 3 insertions, 1 deletions
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