From 20708fa5b65c74ac65671cb56c60197b2f41abd7 Mon Sep 17 00:00:00 2001 From: Thomas Yuan Date: Wed, 16 Sep 2015 11:40:05 -0400 Subject: [PATCH] Only re-bootstrap when there is no enough nodes in routing table. --- src/kademlia/node.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kademlia/node.cpp b/src/kademlia/node.cpp index ed28d4882..5295035ad 100644 --- a/src/kademlia/node.cpp +++ b/src/kademlia/node.cpp @@ -508,8 +508,10 @@ void node::tick() { // every now and then we refresh our own ID, just to keep // expanding the routing table buckets closer to us. + // if m_table.depth() < 4, means routing_table doesn't + // have enough nodes. time_point now = aux::time_now(); - if (m_last_self_refresh + minutes(10) < now) + if (m_last_self_refresh + minutes(10) < now && m_table.depth() < 4) { node_id target = m_id; make_id_secret(target);