/* */ #include "TimedHaltCommand.h" #include "DownloadEngine.h" #include "RequestGroupMan.h" #include "Logger.h" #include "LogFactory.h" #include "message.h" #include "fmt.h" namespace aria2 { TimedHaltCommand::TimedHaltCommand (cuid_t cuid, DownloadEngine* e, time_t secondsToHalt, bool forceHalt) : TimeBasedCommand(cuid, e, secondsToHalt, true), forceHalt_(forceHalt) {} TimedHaltCommand::~TimedHaltCommand() {} void TimedHaltCommand::preProcess() { if(getDownloadEngine()->getRequestGroupMan()->downloadFinished() || getDownloadEngine()->isHaltRequested()) { enableExit(); } } void TimedHaltCommand::process() { if(!getDownloadEngine()->isHaltRequested()) { A2_LOG_NOTICE(fmt(MSG_TIME_HAS_PASSED, static_cast(getInterval()))); if(forceHalt_) { getDownloadEngine()->requestForceHalt(); } else { getDownloadEngine()->requestHalt(); } enableExit(); } } } // namespace aria2