summaryrefslogtreecommitdiff
path: root/src/DownloadEngine.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-02-11 05:07:08 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-02-11 05:07:08 +0000
commit9c277148b9cd1c3ddfc4a2e126d64a230c608255 (patch)
tree8589671cadf1a72fdc52ecc9dfb8d55e699fc3ac /src/DownloadEngine.cc
parent5d6f1c046a9220a8e45d127f12c463a167479872 (diff)
2008-02-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added the ability to stop aria2 itself when given time has passed from start. Use --stop option to specify time in minutes. When 0 is given, this feature is disabled. * src/OptionHandlerFactory.cc * src/TimeBasedCommand.h: Make _interval protected scope. * src/HelpItemFactory.cc * src/option_processing.cc * src/prefs.h * src/FillRequestGroupCommand.cc: Evaluate _e->isHaltRequested() before calling RequestGroupMan::fillRequestGroupFromReserver(). Without this modification, the result list shows "ERR" when aria2 is stopped by --stop option. It should be "INPR". * src/DownloadEngine.{h, cc} * src/DownloadEngineFactory.cc * src/usage_text.h * src/TimedHaltCommand.{h, cc}: New class.
Diffstat (limited to 'src/DownloadEngine.cc')
-rw-r--r--src/DownloadEngine.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc
index da24c057..03e01590 100644
--- a/src/DownloadEngine.cc
+++ b/src/DownloadEngine.cc
@@ -293,8 +293,7 @@ void DownloadEngine::afterEachIteration()
{
if(globalHaltRequested == 1) {
logger->notice(_("Shutdown sequence commencing... Press Ctrl-C again for emergency shutdown."));
- _haltRequested = true;
- _requestGroupMan->halt();
+ requestHalt();
globalHaltRequested = 2;
} else if(globalHaltRequested == 3) {
logger->notice(_("Emergency shutdown sequence commencing..."));
@@ -303,6 +302,12 @@ void DownloadEngine::afterEachIteration()
}
}
+void DownloadEngine::requestHalt()
+{
+ _haltRequested = true;
+ _requestGroupMan->halt();
+}
+
void DownloadEngine::fillCommand()
{
addCommand(_requestGroupMan->getInitialCommands(this));