From 03273c8e491556fb830ddefe99acb66169360197 Mon Sep 17 00:00:00 2001
From: Pascal Rigaux <pixel@mandriva.com>
Date: Tue, 2 Sep 2008 13:10:42 +0000
Subject: - call aria2 with brand-new --uri-selector=adaptive

and use options that makes it work nicely
---
 NEWS             | 2 ++
 urpm/download.pm | 9 +++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index ed61b17e..4bafb4ed 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- call aria2 with brand-new --uri-selector=adaptive
+
 Version 6.5 - 1 September 2008, Thierry Vignaud
 
 - all tools
diff --git a/urpm/download.pm b/urpm/download.pm
index c6a8381a..82d707f4 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -610,6 +610,8 @@ sub sync_aria2 {
     (my $cwd) = getcwd() =~ /(.*)/;
     chdir $options->{dir};
 
+    my $stat_file = ($ENV{HOME} || '/root') . '/.aria2-adaptive-stats';
+
     my @files = uniq(map {
 	my $metalinkfile = $_;
 	$metalinkfile =~ s/metalink:.*/metalink/;
@@ -618,10 +620,13 @@ sub sync_aria2 {
 
     my $aria2c_command = join(" ", map { "'$_'" }
 	"/usr/bin/aria2c",
-	"--timeout", $CONNECT_TIMEOUT,
 	"--auto-file-renaming=false",
 	"--follow-metalink=mem",
-	'--metalink-enable-unique-protocol=true',
+	'--metalink-enable-unique-protocol=false', # so that it can try both ftp and http access on the same server. aria2 will only do this on first calls
+	'--max-tries=1',
+	'--lowest-speed-limit=20K', "--timeout", 3, # $CONNECT_TIMEOUT,
+        '-C3', # maximum number of servers to use for one download
+        '--uri-selector=adaptive', "--server-stat-if=$stat_file", "--server-stat-of=$stat_file",
 	"-Z", "-j1",
 	($options->{'limit-rate'} ? "--max-download-limit=" . $options->{'limit-rate'} : ()),
 	($options->{resume} ? "--continue" : "--allow-overwrite=true"),
-- 
cgit v1.2.1