Index: libtorrent/src/dht/dht_transaction.cc =================================================================== --- libtorrent/src/dht/dht_transaction.cc (revision 1060) +++ libtorrent/src/dht/dht_transaction.cc (working copy) @@ -46,7 +46,7 @@ namespace torrent { DhtSearch::DhtSearch(const HashString& target, const DhtBucket& contacts) - : base_type(dht_compare_closer(target)), + : base_type(dht_compare_closer(m_target = target)), m_pending(0), m_contacted(0), m_replied(0), Index: libtorrent/src/dht/dht_transaction.h =================================================================== --- libtorrent/src/dht/dht_transaction.h (revision 1060) +++ libtorrent/src/dht/dht_transaction.h (working copy) @@ -77,7 +77,7 @@ const HashString& target() const { return m_target; } private: - HashString m_target; + const HashString& m_target; }; // DhtSearch contains a list of nodes sorted by closeness to the given target, @@ -126,7 +126,7 @@ bool start() { m_started = true; return m_pending; } bool complete() const { return m_started && !m_pending; } - const HashString& target() const { return key_comp().target(); } + const HashString& target() const { return m_target; } virtual bool is_announce() const { return false; } @@ -158,6 +158,8 @@ DhtSearch(const DhtSearch& s); bool node_uncontacted(const DhtNode* node) const; + + HashString m_target; }; class DhtAnnounce : public DhtSearch {