mirror of https://github.com/aria2/aria2
Merge cc2620329a
into 5ea3bcc349
commit
6ae927eadf
File diff suppressed because one or more lines are too long
|
@ -1348,6 +1348,13 @@ Advanced Options
|
||||||
BitTorrent seeding which is recognized as completed state.
|
BitTorrent seeding which is recognized as completed state.
|
||||||
Default: ``false``
|
Default: ``false``
|
||||||
|
|
||||||
|
.. option:: --save-not-found[=true|false]
|
||||||
|
|
||||||
|
Save download with :option:`--save-session <--save-session>` option
|
||||||
|
even if the file was not found on the server. This option also saves
|
||||||
|
control file in that situations.
|
||||||
|
Default: ``true``
|
||||||
|
|
||||||
.. option:: --gid=<GID>
|
.. option:: --gid=<GID>
|
||||||
|
|
||||||
Set GID manually. aria2 identifies each download by the ID called
|
Set GID manually. aria2 identifies each download by the ID called
|
||||||
|
|
|
@ -343,6 +343,17 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
|
||||||
op->setChangeOptionForReserved(true);
|
op->setChangeOptionForReserved(true);
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
OptionHandler* op(new BooleanOptionHandler(
|
||||||
|
PREF_SAVE_NOT_FOUND, TEXT_SAVE_NOT_FOUND, A2_V_TRUE,
|
||||||
|
OptionHandler::OPT_ARG));
|
||||||
|
op->addTag(TAG_ADVANCED);
|
||||||
|
op->setInitialOption(true);
|
||||||
|
op->setChangeOption(true);
|
||||||
|
op->setChangeGlobalOption(true);
|
||||||
|
op->setChangeOptionForReserved(true);
|
||||||
|
handlers.push_back(op);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
OptionHandler* op(
|
OptionHandler* op(
|
||||||
new BooleanOptionHandler(PREF_FORCE_SEQUENTIAL, TEXT_FORCE_SEQUENTIAL,
|
new BooleanOptionHandler(PREF_FORCE_SEQUENTIAL, TEXT_FORCE_SEQUENTIAL,
|
||||||
|
|
|
@ -277,38 +277,32 @@ bool SessionSerializer::save(IOFile& fp) const
|
||||||
std::set<a2_gid_t> metainfoCache;
|
std::set<a2_gid_t> metainfoCache;
|
||||||
const DownloadResultList& results = rgman_->getDownloadResults();
|
const DownloadResultList& results = rgman_->getDownloadResults();
|
||||||
for (const auto& dr : results) {
|
for (const auto& dr : results) {
|
||||||
if (dr->result == error_code::FINISHED ||
|
auto save = false;
|
||||||
dr->result == error_code::REMOVED) {
|
switch (dr->result) {
|
||||||
if (dr->option->getAsBool(PREF_FORCE_SAVE)) {
|
case error_code::FINISHED:
|
||||||
if (!writeDownloadResult(fp, metainfoCache, dr, false)) {
|
case error_code::REMOVED:
|
||||||
|
save = dr->option->getAsBool(PREF_FORCE_SAVE);
|
||||||
|
break;
|
||||||
|
case error_code::IN_PROGRESS:
|
||||||
|
save = saveInProgress_;
|
||||||
|
break;
|
||||||
|
case error_code::RESOURCE_NOT_FOUND:
|
||||||
|
case error_code::MAX_FILE_NOT_FOUND:
|
||||||
|
save = dr->option->getAsBool(PREF_SAVE_NOT_FOUND);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
save = saveError_;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (save && !writeDownloadResult(fp, metainfoCache, dr, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (dr->result == error_code::IN_PROGRESS) {
|
|
||||||
if (saveInProgress_) {
|
|
||||||
if (!writeDownloadResult(fp, metainfoCache, dr, false)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// error download
|
|
||||||
if (saveError_) {
|
|
||||||
if (!writeDownloadResult(fp, metainfoCache, dr, false)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
// Save active downloads.
|
// Save active downloads.
|
||||||
const RequestGroupList& groups = rgman_->getRequestGroups();
|
const RequestGroupList& groups = rgman_->getRequestGroups();
|
||||||
for (const auto& rg : groups) {
|
for (const auto& rg : groups) {
|
||||||
std::shared_ptr<DownloadResult> dr = rg->createDownloadResult();
|
auto dr = rg->createDownloadResult();
|
||||||
bool stopped = dr->result == error_code::FINISHED ||
|
bool stopped = dr->result == error_code::FINISHED ||
|
||||||
dr->result == error_code::REMOVED;
|
dr->result == error_code::REMOVED;
|
||||||
if ((!stopped && saveInProgress_) ||
|
if ((!stopped && saveInProgress_) ||
|
||||||
|
@ -321,9 +315,9 @@ bool SessionSerializer::save(IOFile& fp) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (saveWaiting_) {
|
if (saveWaiting_) {
|
||||||
const RequestGroupList& groups = rgman_->getReservedGroups();
|
const auto& groups = rgman_->getReservedGroups();
|
||||||
for (const auto& rg : groups) {
|
for (const auto& rg : groups) {
|
||||||
std::shared_ptr<DownloadResult> result = rg->createDownloadResult();
|
auto result = rg->createDownloadResult();
|
||||||
if (!writeDownloadResult(fp, metainfoCache, result,
|
if (!writeDownloadResult(fp, metainfoCache, result,
|
||||||
rg->isPauseRequested())) {
|
rg->isPauseRequested())) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -349,6 +349,8 @@ PrefPtr PREF_STOP_WITH_PROCESS = makePref("stop-with-process");
|
||||||
PrefPtr PREF_ENABLE_MMAP = makePref("enable-mmap");
|
PrefPtr PREF_ENABLE_MMAP = makePref("enable-mmap");
|
||||||
// value: true | false
|
// value: true | false
|
||||||
PrefPtr PREF_FORCE_SAVE = makePref("force-save");
|
PrefPtr PREF_FORCE_SAVE = makePref("force-save");
|
||||||
|
// value: true | false
|
||||||
|
PrefPtr PREF_SAVE_NOT_FOUND = makePref("save-not-found");
|
||||||
// value: 1*digit
|
// value: 1*digit
|
||||||
PrefPtr PREF_DISK_CACHE = makePref("disk-cache");
|
PrefPtr PREF_DISK_CACHE = makePref("disk-cache");
|
||||||
// value: string
|
// value: string
|
||||||
|
|
|
@ -302,6 +302,8 @@ extern PrefPtr PREF_STOP_WITH_PROCESS;
|
||||||
extern PrefPtr PREF_ENABLE_MMAP;
|
extern PrefPtr PREF_ENABLE_MMAP;
|
||||||
// value: true | false
|
// value: true | false
|
||||||
extern PrefPtr PREF_FORCE_SAVE;
|
extern PrefPtr PREF_FORCE_SAVE;
|
||||||
|
// value: true | false
|
||||||
|
extern PrefPtr PREF_SAVE_NOT_FOUND;
|
||||||
// value: 1*digit
|
// value: 1*digit
|
||||||
extern PrefPtr PREF_DISK_CACHE;
|
extern PrefPtr PREF_DISK_CACHE;
|
||||||
// value: string
|
// value: string
|
||||||
|
|
|
@ -971,6 +971,11 @@
|
||||||
" situations. This may be useful to save\n" \
|
" situations. This may be useful to save\n" \
|
||||||
" BitTorrent seeding which is recognized as\n" \
|
" BitTorrent seeding which is recognized as\n" \
|
||||||
" completed state.")
|
" completed state.")
|
||||||
|
#define TEXT_SAVE_NOT_FOUND \
|
||||||
|
_(" --save-not-found[=true|false] Save download with --save-session option even\n" \
|
||||||
|
" if the file was not found on the server. This\n" \
|
||||||
|
" option also saves control file in that\n" \
|
||||||
|
" situations.")
|
||||||
#define TEXT_DISK_CACHE \
|
#define TEXT_DISK_CACHE \
|
||||||
_(" --disk-cache=SIZE Enable disk cache. If SIZE is 0, the disk cache\n" \
|
_(" --disk-cache=SIZE Enable disk cache. If SIZE is 0, the disk cache\n" \
|
||||||
" is disabled. This feature caches the downloaded\n" \
|
" is disabled. This feature caches the downloaded\n" \
|
||||||
|
|
Loading…
Reference in New Issue