the dht node will now add nodes who sends announce_peer with correct write token. Fixed bug in session where nodes from a .torrent were added to the node even though if it wasn't running.

This commit is contained in:
Arvid Norberg 2006-08-06 18:42:04 +00:00
parent 2daaa9f8d2
commit 4f2d147e07
2 changed files with 13 additions and 5 deletions

View File

@ -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());

View File

@ -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<std::string, int> 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<std::string, int> const&))
&dht::dht_tracker::add_node
, boost::ref(m_impl.m_dht), _1));
}
#endif
// add the torrent to the queue to be checked