From a2eed7e7afb568073fa23c3eda6fcfd30ec3bc2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= Date: Thu, 23 Jul 2015 23:24:55 -0400 Subject: [PATCH] dht: limit total node number per search --- src/dht.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dht.cpp b/src/dht.cpp index 8382ad39..887def08 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -721,7 +721,7 @@ Dht::Search::insertNode(std::shared_ptr node, time_point now, const Blob& return id.xorCmp(nid, sn.node->id) < 0; }); if (!found) { - if (nodes.size()-num_candidates >= SEARCH_NODES) { + if (nodes.size()-num_candidates >= SEARCH_NODES or nodes.size() >= SEARCH_NODES+TARGET_NODES/2) { if (node->isExpired(now)) return false; if (n == nodes.end()) {