/* */ #include "DHTResponseMessage.h" #include "DHTNode.h" #include "util.h" #include "a2functional.h" namespace aria2 { const std::string DHTResponseMessage::R("r"); DHTResponseMessage::DHTResponseMessage( const std::shared_ptr& localNode, const std::shared_ptr& remoteNode, const std::string& transactionID) : DHTAbstractMessage(localNode, remoteNode, transactionID) { } DHTResponseMessage::~DHTResponseMessage() {} const std::string& DHTResponseMessage::getType() const { return R; } void DHTResponseMessage::fillMessage(Dict* msgDict) { msgDict->put(R, getResponse()); } bool DHTResponseMessage::isReply() const { return true; } std::string DHTResponseMessage::toString() const { return fmt("dht response %s TransactionID=%s Remote:%s(%u), id=%s, v=%s, %s", getMessageType().c_str(), util::toHex(getTransactionID()).c_str(), getRemoteNode()->getIPAddress().c_str(), getRemoteNode()->getPort(), util::toHex(getRemoteNode()->getID(), DHT_ID_LENGTH).c_str(), util::torrentPercentEncode(getVersion()).c_str(), toStringOptional().c_str()); } } // namespace aria2