diff --git a/src/kademlia/node.cpp b/src/kademlia/node.cpp index 3a3ecb948..17e1d4789 100644 --- a/src/kademlia/node.cpp +++ b/src/kademlia/node.cpp @@ -431,6 +431,11 @@ void node_impl::on_announce(msg const& m, msg& reply) return; } + // the token was correct. That means this + // node is not spoofing its address. So, let + // the table get a chance to add it. + m_table.node_seen(m.id, m.addr); + torrent_entry& v = m_map[m.info_hash]; peer_entry e; e.addr = tcp::endpoint(m.addr.address(), m.addr.port()); diff --git a/src/session.cpp b/src/session.cpp index ee53dbce7..b281c67c3 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -1269,11 +1269,14 @@ namespace libtorrent d->resume_data = resume_data; #ifndef TORRENT_DISABLE_DHT - torrent_info::nodes_t const& nodes = ti.nodes(); - std::for_each(nodes.begin(), nodes.end(), bind( - (void(dht::dht_tracker::*)(std::pair const&)) - &dht::dht_tracker::add_node - , boost::ref(m_impl.m_dht), _1)); + if (m_impl.m_dht) + { + torrent_info::nodes_t const& nodes = ti.nodes(); + std::for_each(nodes.begin(), nodes.end(), bind( + (void(dht::dht_tracker::*)(std::pair const&)) + &dht::dht_tracker::add_node + , boost::ref(m_impl.m_dht), _1)); + } #endif // add the torrent to the queue to be checked