浏览代码

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

Tatsuhiro Tsujikawa 14 年之前
父节点
当前提交
84b19f154a
共有 6 个文件被更改,包括 32 次插入43 次删除
  1. 10 21
      doc/aria2c.1.asciidoc
  2. 1 1
      src/AdaptiveURISelector.cc
  3. 3 3
      src/Metalink2RequestGroup.cc
  4. 12 8
      src/OptionHandlerFactory.cc
  5. 3 5
      src/usage_text.h
  6. 3 5
      test/DownloadHelperTest.cc

+ 10 - 21
doc/aria2c.1.asciidoc

@@ -49,7 +49,7 @@ Basic Options
 
 
 [[aria2_optref_max_concurrent_downloads]]*-j*, *--max-concurrent-downloads*=N::
 [[aria2_optref_max_concurrent_downloads]]*-j*, *--max-concurrent-downloads*=N::
   Set maximum number of parallel downloads for every static (HTTP/FTP) URI,
   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'
   Default: '5'
 
 
 [[aria2_optref_check_integrity]]*-V*, *--check-integrity*[='true'|'false']::
 [[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
   less than N URIs are given, those URIs are used more than once so
   that N connections total are made simultaneously.  The number of
   that N connections total are made simultaneously.  The number of
   connections to the same host is restricted by
   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'
   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::
 [[aria2_optref_stream_piece_selector]]*--stream-piece-selector*=SELECTOR::
 
 
   Specify piece selection algorithm used in HTTP/FTP download. Piece
   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
   specified.  You are not required to use this option because you can
   specify .metalink files without *<<aria2_optref_metalink_file, -M>>*.
   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::
 [[aria2_optref_metalink_language]]*--metalink-language*=LANGUAGE::
   The language of the file to download.
   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
    scratch. This will be useful for users behind proxy server which
    disables resume.
    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::
 [[aria2_optref_save_session]]*--save-session*=FILE::
 
 
   Save error/unfinished downloads to FILE on exit.  You can pass this
   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_location, metalink-location>>*
 * *<<aria2_optref_metalink_os, metalink-os>>*
 * *<<aria2_optref_metalink_os, metalink-os>>*
 * *<<aria2_optref_metalink_preferred_protocol, metalink-preferred-protocol>>*
 * *<<aria2_optref_metalink_preferred_protocol, metalink-preferred-protocol>>*
-* *<<aria2_optref_metalink_servers, metalink-servers>>*
 * *<<aria2_optref_metalink_version, metalink-version>>*
 * *<<aria2_optref_metalink_version, metalink-version>>*
 * *<<aria2_optref_min_split_size, min-split-size>>*
 * *<<aria2_optref_min_split_size, min-split-size>>*
 * *<<aria2_optref_no_file_allocation_limit, no-file-allocation-limit>>*
 * *<<aria2_optref_no_file_allocation_limit, no-file-allocation-limit>>*

+ 1 - 1
src/AdaptiveURISelector.cc

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

+ 3 - 3
src/Metalink2RequestGroup.cc

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

+ 12 - 8
src/OptionHandlerFactory.cc

@@ -934,6 +934,7 @@ OptionHandlerFactory::createOptionHandlers()
     op->addTag(TAG_HTTP);
     op->addTag(TAG_HTTP);
     handlers.push_back(op);
     handlers.push_back(op);
   }
   }
+  SharedHandle<OptionHandler> splitHandler;
   {
   {
     SharedHandle<OptionHandler> op(new NumberOptionHandler
     SharedHandle<OptionHandler> op(new NumberOptionHandler
                                    (PREF_SPLIT,
                                    (PREF_SPLIT,
@@ -947,6 +948,7 @@ OptionHandlerFactory::createOptionHandlers()
     op->setInitialOption(true);
     op->setInitialOption(true);
     op->setChangeGlobalOption(true);
     op->setChangeGlobalOption(true);
     op->setChangeOptionForReserved(true);
     op->setChangeOptionForReserved(true);
+    splitHandler = op;
     handlers.push_back(op);
     handlers.push_back(op);
   }
   }
   {
   {
@@ -2061,16 +2063,18 @@ OptionHandlerFactory::createOptionHandlers()
     handlers.push_back(op);
     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->addTag(TAG_METALINK);
     op->setInitialOption(true);
     op->setInitialOption(true);
-    op->setChangeGlobalOption(true);
-    op->setChangeOptionForReserved(true);
     handlers.push_back(op);
     handlers.push_back(op);
   }
   }
   {
   {

+ 3 - 5
src/usage_text.h

@@ -54,10 +54,8 @@
     "                              once so that N connections total are made\n" \
     "                              once so that N connections total are made\n" \
     "                              simultaneously. The number of connections to the\n" \
     "                              simultaneously. The number of connections to the\n" \
     "                              same host is restricted by\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                                                 \
 #define TEXT_RETRY_WAIT                                                 \
   _(" --retry-wait=SEC             Set the seconds to wait between retries. \n" \
   _(" --retry-wait=SEC             Set the seconds to wait between retries. \n" \
     "                              With SEC > 0, aria2 will retry download when the\n" \
     "                              With SEC > 0, aria2 will retry download when the\n" \
@@ -232,7 +230,7 @@
 #define TEXT_MAX_CONCURRENT_DOWNLOADS                                   \
 #define TEXT_MAX_CONCURRENT_DOWNLOADS                                   \
   _(" -j, --max-concurrent-downloads=N Set maximum number of parallel downloads for\n" \
   _(" -j, --max-concurrent-downloads=N Set maximum number of parallel downloads for\n" \
     "                              every static (HTTP/FTP) URL, torrent and metalink.\n" \
     "                              every static (HTTP/FTP) URL, torrent and metalink.\n" \
-    "                              See also -s and -C options.")
+    "                              See also --split option.")
 #define TEXT_LOAD_COOKIES                                               \
 #define TEXT_LOAD_COOKIES                                               \
   _(" --load-cookies=FILE          Load Cookies from FILE using the Firefox3 format\n" \
   _(" --load-cookies=FILE          Load Cookies from FILE using the Firefox3 format\n" \
     "                              and Mozilla/Firefox(1.x/2.x)/Netscape format.")
     "                              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));
   std::vector<std::string> uris(vbegin(array), vend(array));
   option_->put(PREF_MAX_CONNECTION_PER_SERVER, "1");
   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_DIR, "/tmp");
   option_->put(PREF_OUT, "file.out");
   option_->put(PREF_OUT, "file.out");
   {
   {
@@ -255,7 +254,7 @@ void DownloadHelperTest::testCreateRequestGroupForUri_Metalink()
     for(size_t i = 0; i < 3; ++i) {
     for(size_t i = 0; i < 3; ++i) {
       CPPUNIT_ASSERT_EQUAL(array[i], xuris[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();
     SharedHandle<DownloadContext> ctx = group->getDownloadContext();
     CPPUNIT_ASSERT_EQUAL(std::string("/tmp/file.out"),
     CPPUNIT_ASSERT_EQUAL(std::string("/tmp/file.out"),
                          ctx->getBasePath());
                          ctx->getBasePath());
@@ -371,9 +370,8 @@ void DownloadHelperTest::testCreateRequestGroupForBitTorrent()
 #ifdef ENABLE_METALINK
 #ifdef ENABLE_METALINK
 void DownloadHelperTest::testCreateRequestGroupForMetalink()
 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_FILE, A2_TEST_DIR"/test.xml");
-  option_->put(PREF_METALINK_SERVERS, "5");
   option_->put(PREF_DIR, "/tmp");
   option_->put(PREF_DIR, "/tmp");
   option_->put(PREF_OUT, "file.out");
   option_->put(PREF_OUT, "file.out");
   {
   {