/* */ #include "BtChokeMessage.h" #include "Peer.h" #include "BtMessageDispatcher.h" #include "BtRequestFactory.h" namespace aria2 { const char BtChokeMessage::NAME[] = "choke"; BtChokeMessage::BtChokeMessage():ZeroBtMessage(ID, NAME) {} BtChokeMessage* 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