diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-03-26 17:12:52 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-03-26 17:20:27 +0900 |
| commit | d64089632e82a2548752c7a6baaa68365a795a74 (patch) | |
| tree | 57fc7b85a8c1290975d58fa4761b04a7695bf7e3 /src/DHTGetPeersMessage.cc | |
| parent | c81b1321122e8509b55c94c0cbca0d8d6d319f0c (diff) | |
| parent | a7cd943a06b1a5ff4515b57060b84037f8d01f9f (diff) | |
Merge branch 'master' into random-webseeding
Diffstat (limited to 'src/DHTGetPeersMessage.cc')
| -rw-r--r-- | src/DHTGetPeersMessage.cc | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/DHTGetPeersMessage.cc b/src/DHTGetPeersMessage.cc index 42a380fa..a2857e1d 100644 --- a/src/DHTGetPeersMessage.cc +++ b/src/DHTGetPeersMessage.cc @@ -53,31 +53,30 @@ const std::string DHTGetPeersMessage::GET_PEERS("get_peers"); const std::string DHTGetPeersMessage::INFO_HASH("info_hash"); -DHTGetPeersMessage::DHTGetPeersMessage -(const std::shared_ptr<DHTNode>& localNode, - const std::shared_ptr<DHTNode>& remoteNode, - const unsigned char* infoHash, - const std::string& transactionID) - : DHTQueryMessage{localNode, remoteNode, transactionID}, - peerAnnounceStorage_{nullptr}, - tokenTracker_{nullptr} +DHTGetPeersMessage::DHTGetPeersMessage( + const std::shared_ptr<DHTNode>& localNode, + const std::shared_ptr<DHTNode>& remoteNode, const unsigned char* infoHash, + const std::string& transactionID) + : DHTQueryMessage{localNode, remoteNode, transactionID}, + peerAnnounceStorage_{nullptr}, + tokenTracker_{nullptr} { memcpy(infoHash_, infoHash, DHT_ID_LENGTH); } void DHTGetPeersMessage::doReceivedAction() { - std::string token = tokenTracker_->generateToken - (infoHash_, getRemoteNode()->getIPAddress(), getRemoteNode()->getPort()); + std::string token = tokenTracker_->generateToken( + infoHash_, getRemoteNode()->getIPAddress(), getRemoteNode()->getPort()); // Check to see localhost has the contents which has same infohash std::vector<std::shared_ptr<Peer>> peers; peerAnnounceStorage_->getPeers(peers, infoHash_); std::vector<std::shared_ptr<DHTNode>> nodes; getRoutingTable()->getClosestKNodes(nodes, infoHash_); - getMessageDispatcher()->addMessageToQueue - (getMessageFactory()->createGetPeersReplyMessage - (getRemoteNode(), std::move(nodes), std::move(peers), token, - getTransactionID())); + getMessageDispatcher()->addMessageToQueue( + getMessageFactory()->createGetPeersReplyMessage( + getRemoteNode(), std::move(nodes), std::move(peers), token, + getTransactionID())); } std::unique_ptr<Dict> DHTGetPeersMessage::getArgument() @@ -105,7 +104,7 @@ void DHTGetPeersMessage::setTokenTracker(DHTTokenTracker* tokenTracker) std::string DHTGetPeersMessage::toStringOptional() const { - return "info_hash="+util::toHex(infoHash_, INFO_HASH_LENGTH); + return "info_hash=" + util::toHex(infoHash_, INFO_HASH_LENGTH); } } // namespace aria2 |
