/* */ #include "BtInterestedMessage.h" #include "Peer.h" #include "PeerStorage.h" #include "SocketBuffer.h" namespace aria2 { const char BtInterestedMessage::NAME[] = "interested"; BtInterestedMessage::BtInterestedMessage() : ZeroBtMessage(ID, NAME), peerStorage_(nullptr) { } BtInterestedMessage::~BtInterestedMessage() = default; std::unique_ptr BtInterestedMessage::create(const unsigned char* data, size_t dataLength) { return ZeroBtMessage::create(data, dataLength); } void BtInterestedMessage::doReceivedAction() { if (isMetadataGetMode()) { return; } auto& peer = getPeer(); peer->peerInterested(true); if (peer->amChoking()) { peerStorage_->executeChoke(); } } void BtInterestedMessage::setPeerStorage(PeerStorage* peerStorage) { peerStorage_ = peerStorage; } } // namespace aria2