From 42362998797940bf6e8f63ac019bfd409f8629bf Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 28 Jul 2014 22:28:11 -0400 Subject: [PATCH] handle excluded peers in DatabaseLookup --- NetDb.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/NetDb.cpp b/NetDb.cpp index 5f74d8bf..cfd46331 100644 --- a/NetDb.cpp +++ b/NetDb.cpp @@ -583,20 +583,28 @@ namespace data { LogPrint ("Number of excluded peers exceeds 512"); numExcluded = 0; // TODO: - } - excluded += numExcluded*32; // TODO: check excluded list and all zeros (exploratory) + } I2NPMessage * replyMsg = nullptr; auto router = FindRouter (buf); if (router) { + LogPrint ("Requested ", key, " found"); router->LoadBuffer (); replyMsg = CreateDatabaseStoreMsg (router); + excluded += numExcluded*32; // we don't care about exluded } else { - std::set excluded; // empty for now - replyMsg = CreateDatabaseSearchReply (buf, GetClosestFloodfill (buf, excluded)); + LogPrint ("Requested ", key, " not found. ", numExcluded, " excluded"); + std::set excludedRouters; + for (int i = 0; i < numExcluded; i++) + { + // TODO: check for all zeroes (exploratory) + excludedRouters.insert (excluded); + excluded += 32; + } + replyMsg = CreateDatabaseSearchReply (buf, GetClosestFloodfill (buf, excludedRouters)); } if (replyMsg) {