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