From 9d75198f7f866aacf20c15b2a20b90daf1c5e947 Mon Sep 17 00:00:00 2001 From: Steven Siloti Date: Sun, 24 Jul 2016 15:41:40 -0700 Subject: [PATCH] re-ping nodes in a bucket when one changes id --- src/kademlia/routing_table.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/kademlia/routing_table.cpp b/src/kademlia/routing_table.cpp index 9c3b61933..2d148005e 100644 --- a/src/kademlia/routing_table.cpp +++ b/src/kademlia/routing_table.cpp @@ -717,6 +717,17 @@ routing_table::add_node_status_t routing_table::add_node_impl(node_entry e) remove_node(existing, existing_bucket); fill_from_replacements(existing_bucket); + + // when we detect possible malicious activity in a bucket, + // schedule the other nodes in the bucket to be pinged soon + // to clean out any other malicious nodes + auto now = aux::time_now(); + for (auto& node : existing_bucket->live_nodes) + { + if (now - node.last_queried > minutes(5)) + node.last_queried = min_time(); + } + return failed_to_add; } }