Skip to content
Snippets Groups Projects
Commit ce7f592b authored by Adrien Béraud's avatar Adrien Béraud Committed by Adrien Béraud
Browse files

search: return if added node is actually removed

parent 111bfea6
No related branches found
No related tags found
No related merge requests found
...@@ -854,12 +854,17 @@ Dht::Search::insertNode(const Sp<Node>& snode, time_point now, const Blob& token ...@@ -854,12 +854,17 @@ Dht::Search::insertNode(const Sp<Node>& snode, time_point now, const Blob& token
expired = false; expired = false;
} }
while (nodes.size() - bad > SEARCH_NODES) { while (nodes.size() - bad > SEARCH_NODES) {
bool removingNode = nodes.back()->node == snode;
if (not expired and nodes.back()->isBad()) if (not expired and nodes.back()->isBad())
bad--; bad--;
nodes.pop_back(); nodes.pop_back();
if (removingNode)
return false;
} }
} }
if (n == nodes.end() or not *n)
return false;
if (not token.empty()) { if (not token.empty()) {
(*n)->candidate = false; (*n)->candidate = false;
(*n)->last_get_reply = now; (*n)->last_get_reply = now;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment