more dht fixing, only pick the most up to date entity for reply

pull/295/head
Jeff Becker 5 years ago
parent d7f715c632
commit e24b595191
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -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)

@ -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);

@ -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();

@ -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;

Loading…
Cancel
Save