summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-04-02 14:23:59 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-04-02 14:23:59 +0000
commit730f7449aefd5537709dcec64a2ef9973a2bc595 (patch)
treea7284a4925c7728720a7351690f0c8d5af0fa4a0
parent4c694b95854c0849380b30787159d265f2bd1b5e (diff)
2010-04-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added forceHalt argument to TimedHaltCommand. Added requestForceHalt() to DownloadEngine. * src/DownloadEngine.cc * src/DownloadEngine.h * src/TimedHaltCommand.cc * src/TimedHaltCommand.h
-rw-r--r--ChangeLog9
-rw-r--r--src/DownloadEngine.cc6
-rw-r--r--src/DownloadEngine.h2
-rw-r--r--src/TimedHaltCommand.cc13
-rw-r--r--src/TimedHaltCommand.h5
5 files changed, 31 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index c5b63cbd..dd104bda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2010-04-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
+ Added forceHalt argument to TimedHaltCommand.
+ Added requestForceHalt() to DownloadEngine.
+ * src/DownloadEngine.cc
+ * src/DownloadEngine.h
+ * src/TimedHaltCommand.cc
+ * src/TimedHaltCommand.h
+
+2010-04-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
+
Possible fix for chunked encoding with Content-Length.
* src/HttpResponseCommand.cc
diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc
index b4760253..2d3b0489 100644
--- a/src/DownloadEngine.cc
+++ b/src/DownloadEngine.cc
@@ -241,6 +241,12 @@ void DownloadEngine::requestHalt()
_requestGroupMan->halt();
}
+void DownloadEngine::requestForceHalt()
+{
+ _haltRequested = true;
+ _requestGroupMan->forceHalt();
+}
+
void DownloadEngine::setStatCalc(const StatCalcHandle& statCalc)
{
_statCalc = statCalc;
diff --git a/src/DownloadEngine.h b/src/DownloadEngine.h
index 3adfe31c..fff1c5fd 100644
--- a/src/DownloadEngine.h
+++ b/src/DownloadEngine.h
@@ -196,6 +196,8 @@ public:
void requestHalt();
+ void requestForceHalt();
+
void setNoWait(bool b);
void addRoutineCommand(Command* command);
diff --git a/src/TimedHaltCommand.cc b/src/TimedHaltCommand.cc
index f4ccff1b..25f1deaf 100644
--- a/src/TimedHaltCommand.cc
+++ b/src/TimedHaltCommand.cc
@@ -42,8 +42,10 @@
namespace aria2 {
TimedHaltCommand::TimedHaltCommand(cuid_t cuid, DownloadEngine* e,
- time_t secondsToHalt):
- TimeBasedCommand(cuid, e, secondsToHalt, true) {}
+ time_t secondsToHalt,
+ bool forceHalt):
+ TimeBasedCommand(cuid, e, secondsToHalt, true),
+ _forceHalt(forceHalt) {}
TimedHaltCommand::~TimedHaltCommand() {}
@@ -58,7 +60,12 @@ void TimedHaltCommand::process()
{
if(!_e->isHaltRequested()) {
logger->notice(MSG_TIME_HAS_PASSED, _interval);
- _e->requestHalt();
+ if(_forceHalt) {
+ _e->requestForceHalt();
+ } else {
+ _e->requestHalt();
+ }
+ _exit = true;
}
}
diff --git a/src/TimedHaltCommand.h b/src/TimedHaltCommand.h
index fe7880ab..0a8a8014 100644
--- a/src/TimedHaltCommand.h
+++ b/src/TimedHaltCommand.h
@@ -40,8 +40,11 @@
namespace aria2 {
class TimedHaltCommand:public TimeBasedCommand {
+private:
+ bool _forceHalt;
public:
- TimedHaltCommand(cuid_t cuid, DownloadEngine* e, time_t secondsToHalt);
+ TimedHaltCommand
+ (cuid_t cuid, DownloadEngine* e, time_t secondsToHalt, bool forceHalt=false);
virtual ~TimedHaltCommand();