/* */ #include "DHTNodeLookupTaskCallback.h" #include "DHTNodeLookupTask.h" #include "DHTAnnouncePeerReplyMessage.h" #include "DHTGetPeersReplyMessage.h" #include "DHTPingReplyMessage.h" #include "DHTFindNodeReplyMessage.h" #include "Peer.h" namespace aria2 { DHTNodeLookupTaskCallback::DHTNodeLookupTaskCallback(DHTNodeLookupTask* task): task_(task) {} void DHTNodeLookupTaskCallback::visit (const DHTAnnouncePeerReplyMessage* message) { // When wrong message type is received, forced to timeout onTimeout(message->getRemoteNode()); } void DHTNodeLookupTaskCallback::visit(const DHTFindNodeReplyMessage* message) { task_->onReceived(message); } void DHTNodeLookupTaskCallback::visit(const DHTGetPeersReplyMessage* message) { // When wrong message type is received, forced to timeout onTimeout(message->getRemoteNode()); } void DHTNodeLookupTaskCallback::visit(const DHTPingReplyMessage* message) { // When wrong message type is received, forced to timeout onTimeout(message->getRemoteNode()); } void DHTNodeLookupTaskCallback::onTimeout (const std::shared_ptr& remoteNode) { task_->onTimeout(remoteNode); } } // namespace aria2