Calculate 'candidateNumber' when we should store Introset

This commit is contained in:
Stephen Shelton 2020-02-28 17:00:49 -07:00
parent 37ca564005
commit d09fd13dd6
No known key found for this signature in database
GPG Key ID: EE4BADACCE8B631C

View File

@ -134,18 +134,22 @@ namespace llarp
} }
else else
{ {
bool found = false; int candidateNumber = -1;
int index = 0;
for(const auto &rc : closestRCs) for(const auto &rc : closestRCs)
{ {
if(rc.pubkey == dht.OurKey()) if(rc.pubkey == dht.OurKey())
{ {
found = true; candidateNumber = index;
break; break;
} }
++index;
} }
if(found) if(candidateNumber >= 0)
{ {
LogInfo("Received PubIntro for ", keyStr, ", txid=", txID,
" and we are candidate ", candidateNumber);
dht.services()->PutNode(introset); dht.services()->PutNode(introset);
replies.emplace_back(new GotIntroMessage({introset}, txID)); replies.emplace_back(new GotIntroMessage({introset}, txID));
} }