Переглянути джерело

Deprecated --metalink-server option. Use --split option instead.

Tatsuhiro Tsujikawa 14 роки тому
батько
коміт
84b19f154a

+ 10 - 21
doc/aria2c.1.asciidoc

@@ -49,7 +49,7 @@ Basic Options
 
 [[aria2_optref_max_concurrent_downloads]]*-j*, *--max-concurrent-downloads*=N::
   Set maximum number of parallel downloads for every static (HTTP/FTP) URI,
-  torrent and metalink. See also *<<aria2_optref_split, -s>>* and *<<aria2_optref_metalink_servers, -C>>* option.
+  torrent and metalink. See also *<<aria2_optref_split, -s>>* option.
   Default: '5'
 
 [[aria2_optref_check_integrity]]*-V*, *--check-integrity*[='true'|'false']::
@@ -257,11 +257,17 @@ aria2c -o myfile.zip "http://mirror1/file.zip" "http://mirror2/file.zip"
   less than N URIs are given, those URIs are used more than once so
   that N connections total are made simultaneously.  The number of
   connections to the same host is restricted by
-  *<<aria2_optref_max_connection_per_server, --max-connection-per-server>>* option.  Please see *<<aria2_optref_max_concurrent_downloads, -j>>* and
-  *<<aria2_optref_min_split_size, --min-split-size>>* option too.  Please note that in Metalink
-  download, this option has no effect and use *<<aria2_optref_metalink_servers, -C>>* option instead.
+  *<<aria2_optref_max_connection_per_server, --max-connection-per-server>>* option.
+  See also *<<aria2_optref_min_split_size, --min-split-size>>* option.
   Default: '5'
 
+[NOTE]
+
+Some Metalinks regulate the number of servers to connect.  aria2
+strictly respects them.  This means that if Metalink defines the
+maxconnections attribute lower than N, then aria2 uses the
+value of maxconnections attribute instead of N.
+
 [[aria2_optref_stream_piece_selector]]*--stream-piece-selector*=SELECTOR::
 
   Specify piece selection algorithm used in HTTP/FTP download. Piece
@@ -770,16 +776,6 @@ Metalink Specific Options
   specified.  You are not required to use this option because you can
   specify .metalink files without *<<aria2_optref_metalink_file, -M>>*.
 
-[[aria2_optref_metalink_servers]]*-C*, *--metalink-servers*=NUM_SERVERS::
-  The number of servers to connect to simultaneously.
-  Some Metalinks regulate the number of servers to connect.
-  aria2 strictly respects them.
-  This means that if Metalink defines the maxconnections attribute lower
-  than NUM_SERVERS, then aria2 uses the value of maxconnections attribute
-  instead of NUM_SERVERS.
-  See also *<<aria2_optref_split, -s>>* and *<<aria2_optref_max_concurrent_downloads, -j>>* options.
-  Default: '5'
-
 [[aria2_optref_metalink_language]]*--metalink-language*=LANGUAGE::
   The language of the file to download.
 
@@ -1142,12 +1138,6 @@ are also allocated if they share the same piece.
    scratch. This will be useful for users behind proxy server which
    disables resume.
 
-[NOTE]
-
-For Metalink downloads, -C1 is recommended for proxy server which
-disables resume, in order to avoid establishing unnecessary
-connections.
-
 [[aria2_optref_save_session]]*--save-session*=FILE::
 
   Save error/unfinished downloads to FILE on exit.  You can pass this
@@ -1599,7 +1589,6 @@ of URIs. These optional lines must start with white space(s).
 * *<<aria2_optref_metalink_location, metalink-location>>*
 * *<<aria2_optref_metalink_os, metalink-os>>*
 * *<<aria2_optref_metalink_preferred_protocol, metalink-preferred-protocol>>*
-* *<<aria2_optref_metalink_servers, metalink-servers>>*
 * *<<aria2_optref_metalink_version, metalink-version>>*
 * *<<aria2_optref_min_split_size, min-split-size>>*
 * *<<aria2_optref_no_file_allocation_limit, no-file-allocation-limit>>*

+ 1 - 1
src/AdaptiveURISelector.cc

@@ -206,7 +206,7 @@ void AdaptiveURISelector::resetCounters()
 {
   nbConnections_ = 1;
   nbServerToEvaluate_ =
-    requestGroup_->getOption()->getAsInt(PREF_METALINK_SERVERS) - 1;
+    requestGroup_->getOption()->getAsInt(PREF_SPLIT) - 1;
 }
 
 void AdaptiveURISelector::tuneDownloadCommand

+ 3 - 3
src/Metalink2RequestGroup.cc

@@ -281,8 +281,8 @@ Metalink2RequestGroup::createRequestGroup
       dctx->setSignature(entry->getSignature());
       rg->setNumConcurrentCommand
         (entry->maxConnections < 0 ?
-         option->getAsInt(PREF_METALINK_SERVERS) :
-         std::min(option->getAsInt(PREF_METALINK_SERVERS),
+         option->getAsInt(PREF_SPLIT) :
+         std::min(option->getAsInt(PREF_SPLIT),
                   static_cast<int32_t>(entry->maxConnections)));
     } else {
       dctx.reset(new DownloadContext());
@@ -313,7 +313,7 @@ Metalink2RequestGroup::createRequestGroup
         offset += (*i)->file->getLength();
       }
       dctx->setFileEntries(fileEntries.begin(), fileEntries.end());
-      rg->setNumConcurrentCommand(option->getAsInt(PREF_METALINK_SERVERS));
+      rg->setNumConcurrentCommand(option->getAsInt(PREF_SPLIT));
     }
     rg->setDownloadContext(dctx);
     rg->setPauseRequested(option->getAsBool(PREF_PAUSE));

+ 12 - 8
src/OptionHandlerFactory.cc

@@ -934,6 +934,7 @@ OptionHandlerFactory::createOptionHandlers()
     op->addTag(TAG_HTTP);
     handlers.push_back(op);
   }
+  SharedHandle<OptionHandler> splitHandler;
   {
     SharedHandle<OptionHandler> op(new NumberOptionHandler
                                    (PREF_SPLIT,
@@ -947,6 +948,7 @@ OptionHandlerFactory::createOptionHandlers()
     op->setInitialOption(true);
     op->setChangeGlobalOption(true);
     op->setChangeOptionForReserved(true);
+    splitHandler = op;
     handlers.push_back(op);
   }
   {
@@ -2061,16 +2063,18 @@ OptionHandlerFactory::createOptionHandlers()
     handlers.push_back(op);
   }
   {
-    SharedHandle<OptionHandler> op(new NumberOptionHandler
-                                   (PREF_METALINK_SERVERS,
-                                    TEXT_METALINK_SERVERS,
-                                    "5",
-                                    1, -1,
-                                    'C'));
+    SharedHandle<OptionHandler> op
+      (new DeprecatedOptionHandler
+       (SharedHandle<OptionHandler>(new NumberOptionHandler
+                                    (PREF_METALINK_SERVERS,
+                                     TEXT_METALINK_SERVERS,
+                                     "5",
+                                     1, -1,
+                                     'C')),
+        splitHandler));
+    op->addTag(TAG_DEPRECATED);
     op->addTag(TAG_METALINK);
     op->setInitialOption(true);
-    op->setChangeGlobalOption(true);
-    op->setChangeOptionForReserved(true);
     handlers.push_back(op);
   }
   {

+ 3 - 5
src/usage_text.h

@@ -54,10 +54,8 @@
     "                              once so that N connections total are made\n" \
     "                              simultaneously. The number of connections to the\n" \
     "                              same host is restricted by\n"        \
-    "                              --max-connection-per-server option. Please see -j\n" \
-    "                              and --min-split-size option too.\n"  \
-    "                              Please note that in Metalink download, this\n" \
-    "                              option has no effect and use -C option instead.")
+    "                              --max-connection-per-server option. See also\n" \
+    "                              --min-split-size option.")
 #define TEXT_RETRY_WAIT                                                 \
   _(" --retry-wait=SEC             Set the seconds to wait between retries. \n" \
     "                              With SEC > 0, aria2 will retry download when the\n" \
@@ -232,7 +230,7 @@
 #define TEXT_MAX_CONCURRENT_DOWNLOADS                                   \
   _(" -j, --max-concurrent-downloads=N Set maximum number of parallel downloads for\n" \
     "                              every static (HTTP/FTP) URL, torrent and metalink.\n" \
-    "                              See also -s and -C options.")
+    "                              See also --split option.")
 #define TEXT_LOAD_COOKIES                                               \
   _(" --load-cookies=FILE          Load Cookies from FILE using the Firefox3 format\n" \
     "                              and Mozilla/Firefox(1.x/2.x)/Netscape format.")

+ 3 - 5
test/DownloadHelperTest.cc

@@ -231,8 +231,7 @@ void DownloadHelperTest::testCreateRequestGroupForUri_Metalink()
   };
   std::vector<std::string> uris(vbegin(array), vend(array));
   option_->put(PREF_MAX_CONNECTION_PER_SERVER, "1");
-  option_->put(PREF_SPLIT, "3");
-  option_->put(PREF_METALINK_SERVERS, "2");
+  option_->put(PREF_SPLIT, "2");
   option_->put(PREF_DIR, "/tmp");
   option_->put(PREF_OUT, "file.out");
   {
@@ -255,7 +254,7 @@ void DownloadHelperTest::testCreateRequestGroupForUri_Metalink()
     for(size_t i = 0; i < 3; ++i) {
       CPPUNIT_ASSERT_EQUAL(array[i], xuris[i]);
     }
-    CPPUNIT_ASSERT_EQUAL((unsigned int)3, group->getNumConcurrentCommand());
+    CPPUNIT_ASSERT_EQUAL((unsigned int)2, group->getNumConcurrentCommand());
     SharedHandle<DownloadContext> ctx = group->getDownloadContext();
     CPPUNIT_ASSERT_EQUAL(std::string("/tmp/file.out"),
                          ctx->getBasePath());
@@ -371,9 +370,8 @@ void DownloadHelperTest::testCreateRequestGroupForBitTorrent()
 #ifdef ENABLE_METALINK
 void DownloadHelperTest::testCreateRequestGroupForMetalink()
 {
-  option_->put(PREF_SPLIT, "3");
+  option_->put(PREF_SPLIT, "5");
   option_->put(PREF_METALINK_FILE, A2_TEST_DIR"/test.xml");
-  option_->put(PREF_METALINK_SERVERS, "5");
   option_->put(PREF_DIR, "/tmp");
   option_->put(PREF_OUT, "file.out");
   {