diff --git a/llarp/dht/localserviceaddresslookup.cpp b/llarp/dht/localserviceaddresslookup.cpp index 0c3dcd19c..def38fc67 100644 --- a/llarp/dht/localserviceaddresslookup.cpp +++ b/llarp/dht/localserviceaddresslookup.cpp @@ -32,7 +32,7 @@ namespace llarp return; } // pick newest if we have more than 1 result - if(valuesFound.size() > 1) + if(valuesFound.size()) { service::IntroSet found; for(const auto &introset : valuesFound) diff --git a/llarp/dht/recursiverouterlookup.cpp b/llarp/dht/recursiverouterlookup.cpp index 0bcab6951..43d09b1f1 100644 --- a/llarp/dht/recursiverouterlookup.cpp +++ b/llarp/dht/recursiverouterlookup.cpp @@ -40,6 +40,17 @@ namespace llarp void RecursiveRouterLookup::SendReply() { + if(valuesFound.size()) + { + RouterContact found; + for(const auto &rc : valuesFound) + { + if(found.OtherIsNewer(rc)) + found = rc; + } + valuesFound.clear(); + valuesFound.emplace_back(found); + } if(resultHandler) { resultHandler(valuesFound); diff --git a/llarp/dht/serviceaddresslookup.cpp b/llarp/dht/serviceaddresslookup.cpp index b64e86bf7..fa2fa02f9 100644 --- a/llarp/dht/serviceaddresslookup.cpp +++ b/llarp/dht/serviceaddresslookup.cpp @@ -81,10 +81,10 @@ namespace llarp handleResult(valuesFound); } // get newest introset - if(valuesFound.size() > 1) + if(valuesFound.size()) { llarp::service::IntroSet found; - for(const auto & introset : valuesFound) + for(const auto &introset : valuesFound) if(found.OtherIsNewer(introset)) found = introset; valuesFound.clear(); diff --git a/llarp/router_contact.hpp b/llarp/router_contact.hpp index 397550e96..e813acc14 100644 --- a/llarp/router_contact.hpp +++ b/llarp/router_contact.hpp @@ -96,7 +96,7 @@ namespace llarp /// node nickname, yw kee llarp::AlignedBuffer< NICKLEN > nickname; - uint64_t last_updated; + uint64_t last_updated = 0; bool BEncode(llarp_buffer_t *buf) const override;