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

Disabled -s option in metalink download.
	* src/Metalink2RequestGroup.cc
pull/1/head
Tatsuhiro Tsujikawa 2007-12-12 14:08:19 +00:00
parent fca7b9d7e4
commit e07ee38ed1
2 changed files with 13 additions and 18 deletions

View File

@ -1,8 +1,13 @@
2007-12-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> 2007-12-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
If several protocols are available for a mirror, aria2 now use one of Disabled -s option in metalink download.
them. --metalink-preferred-protocol option was added to specify the * src/Metalink2RequestGroup.cc
preference of protocol.
2007-12-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
If several protocols are available for a mirror in metalink file,
aria2 now use one of them. --metalink-preferred-protocol option was
added to specify the preference of protocol.
* src/AbstractCommand.cc * src/AbstractCommand.cc
* src/OptionHandlerFactory.cc * src/OptionHandlerFactory.cc
* src/ServerHost.{h, cc} * src/ServerHost.{h, cc}

View File

@ -55,27 +55,17 @@ Metalink2RequestGroup::~Metalink2RequestGroup() {}
class AccumulateNonP2PUrl { class AccumulateNonP2PUrl {
private: private:
Strings* urlsPtr; Strings& urlsPtr;
int32_t split;
public: public:
AccumulateNonP2PUrl(Strings* urlsPtr, int32_t split) AccumulateNonP2PUrl(Strings& urlsPtr)
:urlsPtr(urlsPtr), :urlsPtr(urlsPtr) {}
split(split) {}
void operator()(const MetalinkResourceHandle& resource) { void operator()(const MetalinkResourceHandle& resource) {
int32_t maxConnections;
if(resource->maxConnections < 0) {
maxConnections = split;
} else {
maxConnections = min<int32_t>(resource->maxConnections, split);
}
switch(resource->type) { switch(resource->type) {
case MetalinkResource::TYPE_HTTP: case MetalinkResource::TYPE_HTTP:
case MetalinkResource::TYPE_HTTPS: case MetalinkResource::TYPE_HTTPS:
case MetalinkResource::TYPE_FTP: case MetalinkResource::TYPE_FTP:
for(int32_t s = 1; s <= maxConnections; s++) { urlsPtr.push_back(resource->url);
urlsPtr->push_back(resource->url);
}
break; break;
default: default:
break; break;
@ -174,7 +164,7 @@ RequestGroups Metalink2RequestGroup::createRequestGroup(MetalinkEntries entries)
entry->reorderResourcesByPreference(); entry->reorderResourcesByPreference();
Strings uris; Strings uris;
for_each(entry->resources.begin(), entry->resources.end(), for_each(entry->resources.begin(), entry->resources.end(),
AccumulateNonP2PUrl(&uris, _option->getAsInt(PREF_SPLIT))); AccumulateNonP2PUrl(uris));
RequestGroupHandle rg = new RequestGroup(_option, uris); RequestGroupHandle rg = new RequestGroup(_option, uris);
// If piece hash is specified in the metalink, // If piece hash is specified in the metalink,
// make segment size equal to piece hash size. // make segment size equal to piece hash size.