From d97acacae60da84d5ee34e56111fd93c530ecc21 Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 17 Oct 2016 18:45:20 -0400 Subject: [PATCH] sequential LeaseSet request --- Destination.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Destination.cpp b/Destination.cpp index d400259c..80eecaa2 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -373,26 +373,24 @@ namespace client for (int i = 0; i < num; i++) { i2p::data::IdentHash peerHash (buf + 33 + i*32); - auto floodfill = i2p::data::netdb.FindRouter (peerHash); - if (floodfill) + if (!request->excluded.count (peerHash) && !i2p::data::netdb.FindRouter (peerHash)) { - LogPrint (eLogInfo, "Destination: Requesting ", key.ToBase64 (), " at ", peerHash.ToBase64 ()); - if (SendLeaseSetRequest (key, floodfill, request)) - found = true; - } - else - { LogPrint (eLogInfo, "Destination: Found new floodfill, request it"); // TODO: recheck this message i2p::data::netdb.RequestDestination (peerHash); } } - if (!found) - LogPrint (eLogError, "Destination: Suggested floodfills are not presented in netDb"); + + auto floodfill = i2p::data::netdb.GetClosestFloodfill (key, request->excluded); + if (floodfill) + { + LogPrint (eLogInfo, "Destination: Requesting ", key.ToBase64 (), " at ", floodfill->GetIdentHash ().ToBase64 ()); + if (SendLeaseSetRequest (key, floodfill, request)) + found = true; + } } - else - LogPrint (eLogInfo, "Destination: ", key.ToBase64 (), " was not found on ", MAX_NUM_FLOODFILLS_PER_REQUEST, " floodfills"); if (!found) - { + { + LogPrint (eLogInfo, "Destination: ", key.ToBase64 (), " was not found on ", MAX_NUM_FLOODFILLS_PER_REQUEST, " floodfills"); if (request->requestComplete) request->requestComplete (nullptr); m_LeaseSetRequests.erase (key); }