/* */ #include "BtChokeMessage.h" #include "Peer.h" #include "BtMessageDispatcher.h" #include "BtRequestFactory.h" namespace aria2 { const std::string BtChokeMessage::NAME("choke"); BtChokeMessage::BtChokeMessage():ZeroBtMessage(ID, NAME) {} SharedHandle BtChokeMessage::create (const unsigned char* data, size_t dataLength) { return ZeroBtMessage::create(data, dataLength); } void BtChokeMessage::doReceivedAction() { if(isMetadataGetMode()) { return; } getPeer()->peerChoking(true); getBtMessageDispatcher()->doChokedAction(); getBtRequestFactory()->doChokedAction(); } bool BtChokeMessage::sendPredicate() const { return !getPeer()->amChoking(); } void BtChokeMessage::onSendComplete() { getPeer()->amChoking(true); getBtMessageDispatcher()->doChokingAction(); } } // namespace aria2