/* */ #include "TimedHaltCommand.h" #include "DownloadEngine.h" #include "RequestGroupMan.h" #include "Logger.h" #include "message.h" #include "FileEntry.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(_e->_requestGroupMan->downloadFinished() || _e->isHaltRequested()) { _exit = true; } } void TimedHaltCommand::process() { if(!_e->isHaltRequested()) { logger->notice(MSG_TIME_HAS_PASSED, _interval); if(_forceHalt) { logger->notice("This is emergency shutdown."); _e->requestForceHalt(); } else { _e->requestHalt(); } _exit = true; } } } // namespace aria2