summaryrefslogtreecommitdiffstats
path: root/urpm/download.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-09-02 13:22:07 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-09-02 13:22:07 +0000
commit30886fa74b69d7094112dfef334b5ec6750ed8de (patch)
treee4a5d441845a538c227f2f2be68ec8d42dcdd43a /urpm/download.pm
parent03273c8e491556fb830ddefe99acb66169360197 (diff)
downloadurpmi-30886fa74b69d7094112dfef334b5ec6750ed8de.tar
urpmi-30886fa74b69d7094112dfef334b5ec6750ed8de.tar.gz
urpmi-30886fa74b69d7094112dfef334b5ec6750ed8de.tar.bz2
urpmi-30886fa74b69d7094112dfef334b5ec6750ed8de.tar.xz
urpmi-30886fa74b69d7094112dfef334b5ec6750ed8de.zip
only use the 8 best mirrors, then we let aria2 choose
Diffstat (limited to 'urpm/download.pm')
-rw-r--r--urpm/download.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/urpm/download.pm b/urpm/download.pm
index 82d707f4..05cdf77a 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -877,6 +877,11 @@ sub _sync_webfetch_raw {
%files and die N("unable to handle protocol: %s", join ', ', keys %files);
}
+sub _take_n_elem {
+ my ($n, @l) = @_;
+ @l < $n ? @l : @l[0 .. $n-1];
+}
+
sub _create_metalink_ {
my ($urpm, $medium, $files, $options) = @_;
# Don't create a metalink when downloading mirror list
@@ -894,13 +899,16 @@ sub _create_metalink_ {
qq(<files>),
);
+ # only use the 8 best mirrors, then we let aria2 choose
+ my @mirrors = _take_n_elem(8, @{$mirrors->{list}});
+
foreach my $append (@$files) {
$append =~ s/$mirrors->{chosen}//;
push @metalink, qq(\t<file name=") . basename($append) . qq(">);
push @metalink, qq(\t\t<resources>);
my $i = 0;
- foreach my $mirror (@{$mirrors->{list}}) {
+ foreach my $mirror (@mirrors) {
$i++;
my $type = $mirror->{url};
$type =~ s!://.*!!;