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:
parent
9d75198f7f
commit
6ebc61cef9
|
@ -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())
|
if (m_router_nodes.find(e.ep()) != m_router_nodes.end())
|
||||||
return failed_to_add;
|
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?
|
// do we already have this IP in the table?
|
||||||
if (m_ips.count(e.addr()) > 0)
|
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);
|
table_t::iterator i = find_bucket(e.id);
|
||||||
bucket_t& b = i->live_nodes;
|
bucket_t& b = i->live_nodes;
|
||||||
bucket_t& rb = i->replacements;
|
bucket_t& rb = i->replacements;
|
||||||
|
|
Loading…
Reference in New Issue