mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
don't drop profile of real router too early
This commit is contained in:
parent
ae439b5385
commit
86173400d5
@ -38,7 +38,7 @@ namespace data
|
|||||||
{
|
{
|
||||||
const int NETDB_MIN_ROUTERS = 90;
|
const int NETDB_MIN_ROUTERS = 90;
|
||||||
const int NETDB_MIN_FLOODFILLS = 5;
|
const int NETDB_MIN_FLOODFILLS = 5;
|
||||||
const int NETDB_NUM_FLOODFILLS_THRESHOLD = 1000;
|
const int NETDB_NUM_FLOODFILLS_THRESHOLD = 1500;
|
||||||
const int NETDB_FLOODFILL_EXPIRATION_TIMEOUT = 60 * 60; // 1 hour, in seconds
|
const int NETDB_FLOODFILL_EXPIRATION_TIMEOUT = 60 * 60; // 1 hour, in seconds
|
||||||
const int NETDB_MIN_EXPIRATION_TIMEOUT = 90 * 60; // 1.5 hours
|
const int NETDB_MIN_EXPIRATION_TIMEOUT = 90 * 60; // 1.5 hours
|
||||||
const int NETDB_MAX_EXPIRATION_TIMEOUT = 27 * 60 * 60; // 27 hours
|
const int NETDB_MAX_EXPIRATION_TIMEOUT = 27 * 60 * 60; // 27 hours
|
||||||
|
@ -224,15 +224,11 @@ namespace data
|
|||||||
return (bool)m_LastUnreachableTime;
|
return (bool)m_LastUnreachableTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RouterProfile::IsUseful() const {
|
bool RouterProfile::IsUseful() const
|
||||||
return
|
{
|
||||||
m_NumTunnelsAgreed >= PEER_PROFILE_USEFUL_THRESHOLD ||
|
return IsReal () || m_NumTunnelsNonReplied >= PEER_PROFILE_USEFUL_THRESHOLD;
|
||||||
m_NumTunnelsDeclined >= PEER_PROFILE_USEFUL_THRESHOLD ||
|
|
||||||
m_NumTunnelsNonReplied >= PEER_PROFILE_USEFUL_THRESHOLD ||
|
|
||||||
m_HasConnected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<RouterProfile> GetRouterProfile (const IdentHash& identHash)
|
std::shared_ptr<RouterProfile> GetRouterProfile (const IdentHash& identHash)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -286,7 +282,7 @@ namespace data
|
|||||||
}
|
}
|
||||||
auto ts = GetTime ();
|
auto ts = GetTime ();
|
||||||
for (auto& it: tmp)
|
for (auto& it: tmp)
|
||||||
if (it.second->IsUseful() && it.second->IsUpdated () && (ts - it.second->GetLastUpdateTime ()).total_seconds () < PEER_PROFILE_EXPIRATION_TIMEOUT*3600)
|
if (it.second->IsUseful() && (it.second->IsUpdated () || (ts - it.second->GetLastUpdateTime ()).total_seconds () < PEER_PROFILE_EXPIRATION_TIMEOUT*3600))
|
||||||
it.second->Save (it.first);
|
it.second->Save (it.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user