/* */ #include "DHTPingMessage.h" #include "DHTNode.h" #include "DHTConstants.h" #include "DHTMessageDispatcher.h" #include "DHTMessageFactory.h" #include "DHTMessageCallback.h" #include "DHTPingReplyMessage.h" namespace aria2 { const std::string DHTPingMessage::PING("ping"); DHTPingMessage::DHTPingMessage(const std::shared_ptr& localNode, const std::shared_ptr& remoteNode, const std::string& transactionID) : DHTQueryMessage(localNode, remoteNode, transactionID) { } void DHTPingMessage::doReceivedAction() { // send back ping reply getMessageDispatcher()->addMessageToQueue( getMessageFactory()->createPingReplyMessage( getRemoteNode(), getLocalNode()->getID(), getTransactionID())); } std::unique_ptr DHTPingMessage::getArgument() { auto aDict = Dict::g(); aDict->put(DHTMessage::ID, String::g(getLocalNode()->getID(), DHT_ID_LENGTH)); return aDict; } const std::string& DHTPingMessage::getMessageType() const { return PING; } } // namespace aria2