/* */ #include "DHTBucketRefreshCommand.h" #include "DHTRoutingTable.h" #include "DHTTaskQueue.h" #include "DHTTaskFactory.h" #include "DHTTask.h" #include "DownloadEngine.h" #include "RequestGroupMan.h" namespace aria2 { DHTBucketRefreshCommand::DHTBucketRefreshCommand(cuid_t cuid, DownloadEngine* e, std::chrono::seconds interval) : TimeBasedCommand{cuid, e, std::move(interval)}, routingTable_{nullptr}, taskQueue_{nullptr}, taskFactory_{nullptr} { } DHTBucketRefreshCommand::~DHTBucketRefreshCommand() = default; void DHTBucketRefreshCommand::preProcess() { if (getDownloadEngine()->getRequestGroupMan()->downloadFinished() || getDownloadEngine()->isHaltRequested()) { enableExit(); } } void DHTBucketRefreshCommand::process() { taskQueue_->addPeriodicTask1(taskFactory_->createBucketRefreshTask()); } void DHTBucketRefreshCommand::setRoutingTable(DHTRoutingTable* routingTable) { routingTable_ = routingTable; } void DHTBucketRefreshCommand::setTaskQueue(DHTTaskQueue* taskQueue) { taskQueue_ = taskQueue; } void DHTBucketRefreshCommand::setTaskFactory(DHTTaskFactory* taskFactory) { taskFactory_ = taskFactory; } } // namespace aria2