diff --git a/doc/aria2c.1.asciidoc b/doc/aria2c.1.asciidoc index 8ba7934f..37336aa0 100644 --- a/doc/aria2c.1.asciidoc +++ b/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 *<>* and *<>* option. + torrent and metalink. See also *<>* 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 - *<>* option. Please see *<>* and - *<>* option too. Please note that in Metalink - download, this option has no effect and use *<>* option instead. + *<>* option. + See also *<>* 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_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 *<>* and *<>* 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). * *<>* * *<>* * *<>* -* *<>* * *<>* * *<>* * *<>* diff --git a/src/AdaptiveURISelector.cc b/src/AdaptiveURISelector.cc index 02a598ff..fe9ba404 100644 --- a/src/AdaptiveURISelector.cc +++ b/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 diff --git a/src/Metalink2RequestGroup.cc b/src/Metalink2RequestGroup.cc index 4829355d..e433a1bc 100644 --- a/src/Metalink2RequestGroup.cc +++ b/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(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)); diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index 1a231cd7..a6478921 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -934,6 +934,7 @@ OptionHandlerFactory::createOptionHandlers() op->addTag(TAG_HTTP); handlers.push_back(op); } + SharedHandle splitHandler; { SharedHandle 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 op(new NumberOptionHandler - (PREF_METALINK_SERVERS, - TEXT_METALINK_SERVERS, - "5", - 1, -1, - 'C')); + SharedHandle op + (new DeprecatedOptionHandler + (SharedHandle(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); } { diff --git a/src/usage_text.h b/src/usage_text.h index 6698130a..5c17c2fa 100644 --- a/src/usage_text.h +++ b/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.") diff --git a/test/DownloadHelperTest.cc b/test/DownloadHelperTest.cc index 72c263f7..b9219965 100644 --- a/test/DownloadHelperTest.cc +++ b/test/DownloadHelperTest.cc @@ -231,8 +231,7 @@ void DownloadHelperTest::testCreateRequestGroupForUri_Metalink() }; std::vector 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 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"); {