--checksum option is now available in aria2.changeOption.

--checksum option is now available in aria2.changeOption if download
  is waiting/paused in queue.
pull/2/head
Tatsuhiro Tsujikawa 2011-10-29 19:08:04 +09:00
parent 7cba24e8b2
commit 95c7cb9f3e
2 changed files with 9 additions and 0 deletions

View File

@ -751,6 +751,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP);
op->addTag(TAG_CHECKSUM);
op->setInitialOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op);
}
#endif // ENABLE_MESSAGE_DIGEST

View File

@ -1119,7 +1119,15 @@ void changeOption
const Option& option,
DownloadEngine* e)
{
const SharedHandle<DownloadContext>& dctx = group->getDownloadContext();
group->getOption()->merge(option);
if(option.defined(PREF_CHECKSUM)) {
std::pair<std::string, std::string> p;
util::divide(p, option.get(PREF_CHECKSUM), '=');
util::lowercase(p.first);
util::lowercase(p.second);
dctx->setDigest(p.first, util::fromHex(p.second));
}
if(option.defined(PREF_MAX_DOWNLOAD_LIMIT)) {
group->setMaxDownloadSpeedLimit
(option.getAsInt(PREF_MAX_DOWNLOAD_LIMIT));