Browse Source

don't create profile for every new non-floodfill

pull/1883/head
orignal 2 years ago
parent
commit
b8a99878b6
  1. 4
      libi2pd/NetDb.cpp

4
libi2pd/NetDb.cpp

@ -315,7 +315,7 @@ namespace data
else else
{ {
r = std::make_shared<RouterInfo> (buf, len); r = std::make_shared<RouterInfo> (buf, len);
if (!r->IsUnreachable () && r->HasValidAddresses () && !r->GetProfile ()->IsUnreachable () && if (!r->IsUnreachable () && r->HasValidAddresses () && (!r->IsFloodfill () || !r->GetProfile ()->IsUnreachable ()) &&
i2p::util::GetMillisecondsSinceEpoch () + NETDB_EXPIRATION_TIMEOUT_THRESHOLD*1000LL > r->GetTimestamp ()) i2p::util::GetMillisecondsSinceEpoch () + NETDB_EXPIRATION_TIMEOUT_THRESHOLD*1000LL > r->GetTimestamp ())
{ {
bool inserted = false; bool inserted = false;
@ -1398,7 +1398,7 @@ namespace data
std::unique_lock<std::mutex> l(m_FloodfillsMutex); std::unique_lock<std::mutex> l(m_FloodfillsMutex);
for (const auto& it: m_Floodfills) for (const auto& it: m_Floodfills)
{ {
if (!it->IsUnreachable ()) if (!it->IsUnreachable () && !it->GetProfile ()->IsUnreachable ())
{ {
XORMetric m = destKey ^ it->GetIdentHash (); XORMetric m = destKey ^ it->GetIdentHash ();
if (closeThanUsOnly && ourMetric < m) continue; if (closeThanUsOnly && ourMetric < m) continue;

Loading…
Cancel
Save