/* */ #include "BtHaveAllMessage.h" #include "DlAbortEx.h" #include "Peer.h" #include "StringFormat.h" #include "PieceStorage.h" #include "message.h" namespace aria2 { const std::string BtHaveAllMessage::NAME("have all"); SharedHandle BtHaveAllMessage::create (const unsigned char* data, size_t dataLength) { return ZeroBtMessage::create(data, dataLength); } void BtHaveAllMessage::doReceivedAction() { if(!peer->isFastExtensionEnabled()) { throw DL_ABORT_EX (StringFormat("%s received while fast extension is disabled", toString().c_str()).str()); } if(_metadataGetMode) { return; } pieceStorage->subtractPieceStats(peer->getBitfield(), peer->getBitfieldLength()); peer->setAllBitfield(); pieceStorage->addPieceStats(peer->getBitfield(), peer->getBitfieldLength()); if(peer->isSeeder() && pieceStorage->downloadFinished()) { throw DL_ABORT_EX(MSG_GOOD_BYE_SEEDER); } } } // namespace aria2