cache complete request for a while and not send the same request again

This commit is contained in:
orignal 2024-05-03 13:00:30 -04:00
parent 8a20d3219b
commit 396aa6944d
3 changed files with 52 additions and 30 deletions

View file

@ -780,7 +780,7 @@ namespace data
auto dest = m_Requests.CreateRequest (destination, false, direct, requestComplete); // non-exploratory
if (!dest)
{
LogPrint (eLogWarning, "NetDb: Destination ", destination.ToBase64(), " is requested already");
LogPrint (eLogWarning, "NetDb: Destination ", destination.ToBase64(), " is requested already or cached");
return;
}
@ -1000,7 +1000,7 @@ namespace data
LogPrint (eLogDebug, "NetDb: DatabaseSearchReply for ", key, " num=", num);
IdentHash ident (buf);
auto dest = m_Requests.FindRequest (ident);
if (dest)
if (dest && dest->IsActive ())
{
if (!dest->IsExploratory () && (num > 0 || dest->GetNumExcludedPeers () < 3)) // before 3-rd attempt might be just bad luck
// try to send next requests