/* */ #include "PeerChokeCommand.h" #include "DownloadEngine.h" #include "BtRuntime.h" #include "PeerStorage.h" namespace aria2 { PeerChokeCommand::PeerChokeCommand(cuid_t cuid, DownloadEngine* e) : Command(cuid), e_(e) { } PeerChokeCommand::~PeerChokeCommand() = default; bool PeerChokeCommand::execute() { if (btRuntime_->isHalt()) { return true; } if (peerStorage_->chokeRoundIntervalElapsed()) { peerStorage_->executeChoke(); } e_->addCommand(std::unique_ptr(this)); return false; } void PeerChokeCommand::setBtRuntime(const std::shared_ptr& btRuntime) { btRuntime_ = btRuntime; } void PeerChokeCommand::setPeerStorage( const std::shared_ptr& peerStorage) { peerStorage_ = peerStorage; } } // namespace aria2