mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-30 12:04:13 +00:00
reset floodfill cap for unknown floodfills
This commit is contained in:
parent
b6de474fda
commit
c757b6d020
@ -267,7 +267,12 @@ namespace data
|
|||||||
if (wasFloodfill)
|
if (wasFloodfill)
|
||||||
m_Floodfills.Remove (r->GetIdentHash ());
|
m_Floodfills.Remove (r->GetIdentHash ());
|
||||||
else if (r->IsEligibleFloodfill ())
|
else if (r->IsEligibleFloodfill ())
|
||||||
m_Floodfills.Insert (r);
|
{
|
||||||
|
if (m_Floodfills.GetSize () < NETDB_NUM_FLOODFILLS_THRESHOLD || r->GetProfile ()->IsReal ())
|
||||||
|
m_Floodfills.Insert (r);
|
||||||
|
else
|
||||||
|
r->ResetFlooldFill ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -290,12 +295,16 @@ namespace data
|
|||||||
if (inserted)
|
if (inserted)
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NetDb: RouterInfo added: ", ident.ToBase64());
|
LogPrint (eLogInfo, "NetDb: RouterInfo added: ", ident.ToBase64());
|
||||||
if (r->IsFloodfill () && r->IsEligibleFloodfill () &&
|
if (r->IsFloodfill () && r->IsEligibleFloodfill ())
|
||||||
(m_Floodfills.GetSize () < NETDB_NUM_FLOODFILLS_THRESHOLD ||
|
|
||||||
r->GetProfile ()->IsReal ())) // don't insert floodfill until it's known real if we have enough
|
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
|
if (m_Floodfills.GetSize () < NETDB_NUM_FLOODFILLS_THRESHOLD ||
|
||||||
m_Floodfills.Insert (r);
|
r->GetProfile ()->IsReal ()) // don't insert floodfill until it's known real if we have enough
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
|
||||||
|
m_Floodfills.Insert (r);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
r->ResetFlooldFill ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -224,6 +224,7 @@ namespace data
|
|||||||
void UpdateSupportedTransports ();
|
void UpdateSupportedTransports ();
|
||||||
void UpdateIntroducers (uint64_t ts); // ts in seconds
|
void UpdateIntroducers (uint64_t ts); // ts in seconds
|
||||||
bool IsFloodfill () const { return m_Caps & Caps::eFloodfill; };
|
bool IsFloodfill () const { return m_Caps & Caps::eFloodfill; };
|
||||||
|
void ResetFlooldFill () { m_Caps &= ~Caps::eFloodfill; };
|
||||||
bool IsECIES () const { return m_RouterIdentity->GetCryptoKeyType () == i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD; };
|
bool IsECIES () const { return m_RouterIdentity->GetCryptoKeyType () == i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD; };
|
||||||
bool IsNTCP2 (bool v4only = true) const;
|
bool IsNTCP2 (bool v4only = true) const;
|
||||||
bool IsNTCP2V6 () const { return m_SupportedTransports & eNTCP2V6; };
|
bool IsNTCP2V6 () const { return m_SupportedTransports & eNTCP2V6; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user