Преглед изворни кода

2007-12-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Added --metalink-enable-unique-protocol option.
	* src/Metalink2RequestGroup.cc
	* src/option_processing.cc
	* src/prefs.h
	* src/version_usage.cc
	* doc/aria2c.1.txt
	* doc/aria2c.1
Tatsuhiro Tsujikawa пре 18 година
родитељ
комит
7ff1f5a620
7 измењених фајлова са 42 додато и 5 уклоњено
  1. 10 0
      ChangeLog
  2. 9 2
      doc/aria2c.1
  3. 7 0
      doc/aria2c.1.txt
  4. 3 3
      src/Metalink2RequestGroup.cc
  5. 5 0
      src/option_processing.cc
  6. 2 0
      src/prefs.h
  7. 6 0
      src/version_usage.cc

+ 10 - 0
ChangeLog

@@ -1,3 +1,13 @@
+2007-12-22  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Added --metalink-enable-unique-protocol option.
+	* src/Metalink2RequestGroup.cc
+	* src/option_processing.cc
+	* src/prefs.h
+	* src/version_usage.cc
+	* doc/aria2c.1.txt
+	* doc/aria2c.1
+
 2007-12-22  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Allow a peer in incomingPeer to be added peers.

+ 9 - 2
doc/aria2c.1

@@ -1,11 +1,11 @@
 .\"     Title: aria2c
 .\"    Author: 
 .\" Generator: DocBook XSL Stylesheets v1.73.1 <http://docbook.sf.net/>
-.\"      Date: 12/12/2007
+.\"      Date: 12/22/2007
 .\"    Manual: 
 .\"    Source: 
 .\"
-.TH "ARIA2C" "1" "12/12/2007" "" ""
+.TH "ARIA2C" "1" "12/22/2007" "" ""
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
@@ -467,6 +467,13 @@ is specified, the action mentioned above is not taken\. Default:
 \fItrue\fR
 .RE
 .PP
+\-\-metalink\-enable\-unique\-protocol=\fItrue\fR|\fIfalse\fR
+.RS 4
+If
+\fItrue\fR
+is given and several protocols are available for a mirror in a metalink file, aria2 uses one of them\. Use \-\-metalink\-preferred\-protocol option to specify the preference of protocol\. Default: true
+.RE
+.PP
 \-v, \-\-version
 .RS 4
 Print the version number, copyright and the configuration information and exit\.

+ 7 - 0
doc/aria2c.1.txt

@@ -333,6 +333,13 @@ OPTIONS
   If 'false' is specified, the action mentioned above is not taken.
   Default: 'true'
 
+--metalink-enable-unique-protocol='true'|'false'::
+  If 'true' is given and several protocols are available for a mirror in a
+  metalink file, aria2 uses one of them.
+  Use --metalink-preferred-protocol option to specify the preference of
+  protocol.
+  Default: true
+
 -v, --version::
   Print the version number, copyright and the configuration information and
   exit.

+ 3 - 3
src/Metalink2RequestGroup.cc

@@ -199,9 +199,9 @@ RequestGroups Metalink2RequestGroup::createRequestGroup(MetalinkEntries entries)
     rg->setNumConcurrentCommand(entry->maxConnections < 0 ?
 				_option->getAsInt(PREF_METALINK_SERVERS) :
 				min<int32_t>(_option->getAsInt(PREF_METALINK_SERVERS), entry->maxConnections));
-    // In metalink, multi connection to a single host is not allowed.
-    rg->setSingleHostMultiConnectionEnabled(false);
-
+    // In metalink, multi connection to a single host is not allowed by default.
+    rg->setSingleHostMultiConnectionEnabled(!_option->getAsBool(PREF_METALINK_ENABLE_UNIQUE_PROTOCOL));
+    
 #ifdef ENABLE_BITTORRENT
     // Inject depenency between rg and torrentRg here if torrentRg.isNull() == false
     if(!torrentRg.isNull()) {

+ 5 - 0
src/option_processing.cc

@@ -130,6 +130,7 @@ Option* option_processing(int argc, char* const argv[])
   op->put(PREF_ALLOW_PIECE_LENGTH_CHANGE, V_FALSE);
   op->put(PREF_METALINK_PREFERRED_PROTOCOL, V_NONE);
   op->put(PREF_ENABLE_PEER_EXCHANGE, V_TRUE);
+  op->put(PREF_METALINK_ENABLE_UNIQUE_PROTOCOL, V_TRUE);
   while(1) {
     int optIndex = 0;
     int lopt;
@@ -208,6 +209,7 @@ Option* option_processing(int argc, char* const argv[])
       { "follow-metalink", required_argument, &lopt, 103 },
       { "metalink-location", required_argument, &lopt, 104 },
       { "metalink-preferred-protocol", required_argument, &lopt, 105 },
+      { "metalink-enable-unique-protocol", optional_argument, &lopt, 106 },
 #endif // ENABLE_METALINK
       { "version", no_argument, NULL, 'v' },
       { "help", no_argument, NULL, 'h' },
@@ -306,6 +308,9 @@ Option* option_processing(int argc, char* const argv[])
       case 105:
 	cmdstream << PREF_METALINK_PREFERRED_PROTOCOL << "=" << optarg << "\n";
 	break;
+      case 106:
+	cmdstream << PREF_METALINK_ENABLE_UNIQUE_PROTOCOL << "=" << toBoolArg(optarg) << "\n";
+	break;
       case 200:
 	cmdstream << PREF_LOWEST_SPEED_LIMIT << "=" << optarg << "\n";
 	break;

+ 2 - 0
src/prefs.h

@@ -232,5 +232,7 @@
 #  define V_HTTP "http"
 #  define V_HTTPS "https"
 #  define V_FTP "ftp"
+// values: true | false
+#define PREF_METALINK_ENABLE_UNIQUE_PROTOCOL "metalink-enable-unique-protocol"
 
 #endif // _D_PREFS_H_

+ 6 - 0
src/version_usage.cc

@@ -314,6 +314,12 @@ void showUsage() {
 	    "                              If false is specified, the action mentioned above\n"
 	    "                              is not taken.") << "\n"
        << DEFAULT_MSG << "true" << "\n";
+  cout << _(" --metalink-enable-unique-protocol=true|false If true is given and several\n"
+	    "                              protocols are available for a mirror in a metalink\n"
+	    "                              file, aria2 uses one of them.\n"
+	    "                              Use --metalink-preferred-protocol option to\n"
+	    "                              specify the preference of protocol.") << "\n"
+       << DEFAULT_MSG << "true" << "\n";
 #endif // ENABLE_METALINK
   cout << _(" -v, --version                Print the version number and exit.") << endl;
   cout << _(" -h, --help                   Print this message and exit.") << endl;