From 8f3bd1052e1fadb6231ab2783444c08650af003e Mon Sep 17 00:00:00 2001 From: Sivachandran Date: Mon, 18 Jul 2016 19:42:10 +0530 Subject: [PATCH] fix mutable dht_get_item failure when salt is non-empty (#909) --- include/libtorrent/kademlia/get_item.hpp | 1 - src/kademlia/get_item.cpp | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/libtorrent/kademlia/get_item.hpp b/include/libtorrent/kademlia/get_item.hpp index 00df641c9..2b6b592e1 100644 --- a/include/libtorrent/kademlia/get_item.hpp +++ b/include/libtorrent/kademlia/get_item.hpp @@ -72,7 +72,6 @@ protected: data_callback m_data_callback; item m_data; - std::string m_salt; bool m_immutable; }; diff --git a/src/kademlia/get_item.cpp b/src/kademlia/get_item.cpp index 317b9a151..61c9bd3c4 100644 --- a/src/kademlia/get_item.cpp +++ b/src/kademlia/get_item.cpp @@ -78,7 +78,8 @@ void get_item::got_data(bdecode_node const& v, // data can reach here, which means pk and sig must be valid. if (!pk || !sig) return; - std::pair salt(m_salt.c_str(), int(m_salt.size())); + std::string temp_copy(m_data.salt()); + std::pair salt(temp_copy.c_str(), int(temp_copy.size())); sha1_hash incoming_target = item_target_id(salt, pk); if (incoming_target != m_target) return;