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
pull/1/head
Tatsuhiro Tsujikawa 2010-04-02 14:23:59 +00:00
parent 4c694b9585
commit 730f7449ae
5 changed files with 31 additions and 4 deletions

View File

@ -1,3 +1,12 @@
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.

View File

@ -241,6 +241,12 @@ void DownloadEngine::requestHalt()
_requestGroupMan->halt();
}
void DownloadEngine::requestForceHalt()
{
_haltRequested = true;
_requestGroupMan->forceHalt();
}
void DownloadEngine::setStatCalc(const StatCalcHandle& statCalc)
{
_statCalc = statCalc;

View File

@ -196,6 +196,8 @@ public:
void requestHalt();
void requestForceHalt();
void setNoWait(bool b);
void addRoutineCommand(Command* command);

View File

@ -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;
}
}

View File

@ -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();