/* */ #include "BtRejectMessage.h" #include "DlAbortEx.h" #include "Peer.h" #include "RequestSlot.h" #include "BtMessageDispatcher.h" #include "fmt.h" namespace aria2 { const std::string BtRejectMessage::NAME("reject"); BtRejectMessage::BtRejectMessage (size_t index, int32_t begin, int32_t length): RangeBtMessage(ID, NAME, index, begin, length) {} SharedHandle BtRejectMessage::create (const unsigned char* data, size_t dataLength) { return RangeBtMessage::create(data, dataLength); } void BtRejectMessage::doReceivedAction() { if(!getPeer()->isFastExtensionEnabled()) { throw DL_ABORT_EX (fmt("%s received while fast extension is disabled.", toString().c_str())); } if(isMetadataGetMode()) { return; } // TODO Current implementation does not close a connection even if // a request for this reject message has never sent. RequestSlot slot = getBtMessageDispatcher()->getOutstandingRequest (getIndex(), getBegin(), getLength()); if(RequestSlot::isNull(slot)) { //throw DL_ABORT_EX("reject received, but it is not in the request slots."); } else { getBtMessageDispatcher()->removeOutstandingRequest(slot); } } } // namespace aria2