2008-10-13 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Added --auto-save-interval=SEC option. A control file(*.aria2) 
is saved
	every SEC seconds.
	* src/DownloadEngineFactory.cc
	* src/OptionHandlerFactory.cc
	* src/option_processing.cc
	* src/usage_text.h
pull/1/head
Tatsuhiro Tsujikawa 2008-10-13 13:07:53 +00:00
parent 6ef72a14a2
commit 3779b4cf3e
5 changed files with 26 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2008-10-13 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added --auto-save-interval=SEC option. A control file(*.aria2) is saved
every SEC seconds.
* src/DownloadEngineFactory.cc
* src/OptionHandlerFactory.cc
* src/option_processing.cc
* src/usage_text.h
2008-10-13 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed compile warning on linux-amd64

View File

@ -91,7 +91,11 @@ DownloadEngineFactory::newDownloadEngine(Option* op,
#endif // ENABLE_MESSAGE_DIGEST
e->addRoutineCommand(new FillRequestGroupCommand(CUIDCounterSingletonHolder::instance()->newID(), e.get(), 1));
e->addRoutineCommand(new FileAllocationDispatcherCommand(CUIDCounterSingletonHolder::instance()->newID(), e.get()));
e->addRoutineCommand(new AutoSaveCommand(CUIDCounterSingletonHolder::instance()->newID(), e.get(), op->getAsInt(PREF_AUTO_SAVE_INTERVAL)));
if(op->getAsInt(PREF_AUTO_SAVE_INTERVAL) > 0) {
e->addRoutineCommand
(new AutoSaveCommand(CUIDCounterSingletonHolder::instance()->newID(),
e.get(), op->getAsInt(PREF_AUTO_SAVE_INTERVAL)));
}
e->addRoutineCommand(new HaveEraseCommand(CUIDCounterSingletonHolder::instance()->newID(), e.get(), 10));
{
time_t stopSec = op->getAsInt(PREF_STOP);

View File

@ -83,10 +83,10 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
{
SharedHandle<OptionHandler> op(new NumberOptionHandler
(PREF_AUTO_SAVE_INTERVAL,
NO_DESCRIPTION,
TEXT_AUTO_SAVE_INTERVAL,
"60",
1, 600,
true));
0, 600));
op->addTag(TAG_ADVANCED);
handlers.push_back(op);
}
{

View File

@ -160,6 +160,7 @@ Option* option_processing(int argc, char* const argv[])
{ PREF_REMOTE_TIME.c_str(), optional_argument, 0, 'R' },
{ PREF_CONNECT_TIMEOUT.c_str(), required_argument, &lopt, 224 },
{ PREF_MAX_FILE_NOT_FOUND.c_str(), required_argument, &lopt, 225 },
{ PREF_AUTO_SAVE_INTERVAL.c_str(), required_argument, &lopt, 226 },
#if defined ENABLE_BITTORRENT || defined ENABLE_METALINK
{ PREF_SHOW_FILES.c_str(), no_argument, NULL, 'S' },
{ PREF_SELECT_FILE.c_str(), required_argument, &lopt, 21 },
@ -405,6 +406,9 @@ Option* option_processing(int argc, char* const argv[])
case 225:
cmdstream << PREF_MAX_FILE_NOT_FOUND << "=" << optarg << "\n";
break;
case 226:
cmdstream << PREF_AUTO_SAVE_INTERVAL << "=" << optarg << "\n";
break;
}
break;
}

View File

@ -373,3 +373,8 @@ _(" --server-stat-if=FILE Specify the filename to load performance profil
_(" --server-stat-timeout=SEC Specifies timeout in seconds to invalidate\n"\
" performance profile of the servers since the last\n"\
" contact to them.")
#define TEXT_AUTO_SAVE_INTERVAL \
_(" --auto-save-interval=SEC Save a control file(*.aria2) every SEC seconds.\n"\
" If 0 is given, a control file is not saved during\n"\
" download. aria2 saves a control file when it stops\n"\
" regardless of the value.")