mirror of https://github.com/aria2/aria2
Code cleanup
parent
84b19f154a
commit
4532881eb6
|
@ -237,6 +237,8 @@ Metalink2RequestGroup::createRequestGroup
|
||||||
SharedHandle<Option> option = util::copy(optionTemplate);
|
SharedHandle<Option> option = util::copy(optionTemplate);
|
||||||
SharedHandle<RequestGroup> rg(new RequestGroup(option));
|
SharedHandle<RequestGroup> rg(new RequestGroup(option));
|
||||||
SharedHandle<DownloadContext> dctx;
|
SharedHandle<DownloadContext> dctx;
|
||||||
|
int numSplit = option->getAsInt(PREF_SPLIT);
|
||||||
|
int maxConn = option->getAsInt(PREF_MAX_CONNECTION_PER_SERVER);
|
||||||
if(mes.size() == 1) {
|
if(mes.size() == 1) {
|
||||||
SharedHandle<MetalinkEntry> entry = mes[0];
|
SharedHandle<MetalinkEntry> entry = mes[0];
|
||||||
A2_LOG_INFO(fmt(MSG_METALINK_QUEUEING, entry->getPath().c_str()));
|
A2_LOG_INFO(fmt(MSG_METALINK_QUEUEING, entry->getPath().c_str()));
|
||||||
|
@ -262,8 +264,7 @@ Metalink2RequestGroup::createRequestGroup
|
||||||
util::applyDir(option->get(PREF_DIR),
|
util::applyDir(option->get(PREF_DIR),
|
||||||
entry->file->getPath())));
|
entry->file->getPath())));
|
||||||
dctx->getFirstFileEntry()->setUris(uris);
|
dctx->getFirstFileEntry()->setUris(uris);
|
||||||
dctx->getFirstFileEntry()->setMaxConnectionPerServer
|
dctx->getFirstFileEntry()->setMaxConnectionPerServer(maxConn);
|
||||||
(option->getAsInt(PREF_MAX_CONNECTION_PER_SERVER));
|
|
||||||
if(option->getAsBool(PREF_METALINK_ENABLE_UNIQUE_PROTOCOL)) {
|
if(option->getAsBool(PREF_METALINK_ENABLE_UNIQUE_PROTOCOL)) {
|
||||||
dctx->getFirstFileEntry()->setUniqueProtocol(true);
|
dctx->getFirstFileEntry()->setUniqueProtocol(true);
|
||||||
}
|
}
|
||||||
|
@ -281,9 +282,7 @@ Metalink2RequestGroup::createRequestGroup
|
||||||
dctx->setSignature(entry->getSignature());
|
dctx->setSignature(entry->getSignature());
|
||||||
rg->setNumConcurrentCommand
|
rg->setNumConcurrentCommand
|
||||||
(entry->maxConnections < 0 ?
|
(entry->maxConnections < 0 ?
|
||||||
option->getAsInt(PREF_SPLIT) :
|
numSplit : std::min(numSplit, entry->maxConnections));
|
||||||
std::min(option->getAsInt(PREF_SPLIT),
|
|
||||||
static_cast<int32_t>(entry->maxConnections)));
|
|
||||||
} else {
|
} else {
|
||||||
dctx.reset(new DownloadContext());
|
dctx.reset(new DownloadContext());
|
||||||
// piece length is overridden by the one in torrent file.
|
// piece length is overridden by the one in torrent file.
|
||||||
|
@ -303,8 +302,7 @@ Metalink2RequestGroup::createRequestGroup
|
||||||
(new FileEntry
|
(new FileEntry
|
||||||
(util::applyDir(option->get(PREF_DIR), (*i)->file->getPath()),
|
(util::applyDir(option->get(PREF_DIR), (*i)->file->getPath()),
|
||||||
(*i)->file->getLength(), offset, uris));
|
(*i)->file->getLength(), offset, uris));
|
||||||
fe->setMaxConnectionPerServer
|
fe->setMaxConnectionPerServer(maxConn);
|
||||||
(option->getAsInt(PREF_MAX_CONNECTION_PER_SERVER));
|
|
||||||
if(option->getAsBool(PREF_METALINK_ENABLE_UNIQUE_PROTOCOL)) {
|
if(option->getAsBool(PREF_METALINK_ENABLE_UNIQUE_PROTOCOL)) {
|
||||||
fe->setUniqueProtocol(true);
|
fe->setUniqueProtocol(true);
|
||||||
}
|
}
|
||||||
|
@ -313,7 +311,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_SPLIT));
|
rg->setNumConcurrentCommand(numSplit);
|
||||||
}
|
}
|
||||||
rg->setDownloadContext(dctx);
|
rg->setDownloadContext(dctx);
|
||||||
rg->setPauseRequested(option->getAsBool(PREF_PAUSE));
|
rg->setPauseRequested(option->getAsBool(PREF_PAUSE));
|
||||||
|
|
Loading…
Reference in New Issue