/* */ #include "BtInterestedMessage.h" #include "Peer.h" #include "PeerStorage.h" namespace aria2 { const std::string BtInterestedMessage::NAME("interested"); BtInterestedMessage::BtInterestedMessage():ZeroBtMessage(ID, NAME) {} BtInterestedMessage::~BtInterestedMessage() {} SharedHandle BtInterestedMessage::create (const unsigned char* data, size_t dataLength) { return ZeroBtMessage::create(data, dataLength); } void BtInterestedMessage::doReceivedAction() { if(isMetadataGetMode()) { return; } getPeer()->peerInterested(true); if(!getPeer()->amChoking()) { peerStorage_->executeChoke(); } } bool BtInterestedMessage::sendPredicate() const { return !getPeer()->amInterested(); } void BtInterestedMessage::onSendComplete() { getPeer()->amInterested(true); } void BtInterestedMessage::setPeerStorage (const SharedHandle& peerStorage) { peerStorage_ = peerStorage; } } // namespace aria2