Compare commits

...
1 Commits
Author SHA1 Message Date
Adrien Béraud ef0bd6db77 search: return if added node is actually removed 2023-12-08 09:52:20 -05:00
+6 -1
View File
@@ -854,12 +854,17 @@ Dht::Search::insertNode(const Sp<Node>& snode, time_point now, const Blob& token
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())
bad--;
nodes.pop_back();
if (removingNode)
return false;
}
}
if (n == nodes.end() or not *n)
return false;
if (not token.empty()) {
(*n)->candidate = false;
(*n)->last_get_reply = now;