/* */ #include "TimedHaltCommand.h" #include "DownloadEngine.h" #include "RequestGroupMan.h" #include "Logger.h" #include "message.h" #include "FileEntry.h" #include "ServerStatMan.h" #include "FileAllocationEntry.h" #include "CheckIntegrityEntry.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()) { getLogger()->notice(MSG_TIME_HAS_PASSED, getInterval()); if(_forceHalt) { getLogger()->notice("This is emergency shutdown."); getDownloadEngine()->requestForceHalt(); } else { getDownloadEngine()->requestHalt(); } enableExit(); } } } // namespace aria2