From ba8313e57e4f8c94aaefa493eda4a3d24eb45365 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 7 Feb 2019 17:48:41 -0500 Subject: [PATCH] limit replies on introset lookup, pick newest --- llarp/dht/serviceaddresslookup.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/llarp/dht/serviceaddresslookup.cpp b/llarp/dht/serviceaddresslookup.cpp index b630e4b39..9f13b1fde 100644 --- a/llarp/dht/serviceaddresslookup.cpp +++ b/llarp/dht/serviceaddresslookup.cpp @@ -80,7 +80,16 @@ namespace llarp { handleResult(valuesFound); } - + // get newest introset + if(valuesFound.size() > 1) + { + IntroSet found; + for(const auto & introset : valuesFound) + if(found.OtherIsNewer(introset)) + found = introset; + valuesFound.clear(); + valuesFound.emplace_back(found); + } parent->DHTSendTo(whoasked.node.as_array(), new GotIntroMessage(valuesFound, whoasked.txid)); }