From 626baade75005cedd1198765c2333f4205cc9d2e Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 19 Dec 2015 22:06:25 -0500 Subject: [PATCH] fix dht_storage bug --- src/kademlia/dht_storage.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kademlia/dht_storage.cpp b/src/kademlia/dht_storage.cpp index 7665d07d5..37fbad3a1 100644 --- a/src/kademlia/dht_storage.cpp +++ b/src/kademlia/dht_storage.cpp @@ -423,10 +423,13 @@ namespace { // delete the least important one (i.e. the one // the fewest peers are announcing) + // TODO: c++11 use a lambda here instead dht_mutable_table_t::iterator j = std::min_element(m_mutable_table.begin() , m_mutable_table.end() , boost::bind(&dht_immutable_item::num_announcers - , boost::bind(&dht_mutable_table_t::value_type::second, _1))); + , boost::bind(&dht_mutable_table_t::value_type::second, _1)) + < boost::bind(&dht_immutable_item::num_announcers + , boost::bind(&dht_mutable_table_t::value_type::second, _2))); TORRENT_ASSERT(j != m_mutable_table.end()); free(j->second.value); free(j->second.salt);