reject nodes with our id after checking for an existing entry

This allows us to evict nodes which start reporting our id as theirs.
This commit is contained in:
Steven Siloti 2016-07-24 17:22:04 -07:00
parent 9d75198f7f
commit 6ebc61cef9
1 changed files with 3 additions and 3 deletions

View File

@ -648,9 +648,6 @@ routing_table::add_node_status_t routing_table::add_node_impl(node_entry e)
if (m_router_nodes.find(e.ep()) != m_router_nodes.end())
return failed_to_add;
// don't add ourself
if (e.id == m_id) return failed_to_add;
// do we already have this IP in the table?
if (m_ips.count(e.addr()) > 0)
{
@ -732,6 +729,9 @@ routing_table::add_node_status_t routing_table::add_node_impl(node_entry e)
}
}
// don't add ourself
if (e.id == m_id) return failed_to_add;
table_t::iterator i = find_bucket(e.id);
bucket_t& b = i->live_nodes;
bucket_t& rb = i->replacements;