mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-31 04:44:13 +00:00
check actual distance with router to reduce expiration time
This commit is contained in:
parent
a6ee1e648e
commit
a3f62e1d71
@ -661,12 +661,13 @@ namespace data
|
|||||||
}
|
}
|
||||||
else if (checkForExpiration)
|
else if (checkForExpiration)
|
||||||
{
|
{
|
||||||
uint64_t t = expirationTimeout;
|
if (ts > it.second->GetTimestamp () + expirationTimeout)
|
||||||
if (total > NETDB_NUM_ROUTERS_THRESHOLD && !it.second->IsHighBandwidth () && // low bandwidth router
|
|
||||||
((it.second->GetIdentHash()[0] & 0xFE) != (i2p::context.GetIdentHash ()[0] & 0xFE))) // different first 7 bits
|
|
||||||
t >>= 1; // reduce expiration time by 2 times
|
|
||||||
if (ts > it.second->GetTimestamp () + t)
|
|
||||||
it.second->SetUnreachable (true);
|
it.second->SetUnreachable (true);
|
||||||
|
else if ((ts > it.second->GetTimestamp () + expirationTimeout/2) && // more than half of expiration
|
||||||
|
total > NETDB_NUM_ROUTERS_THRESHOLD && !it.second->IsHighBandwidth() && // low bandwidth
|
||||||
|
!it.second->IsFloodfill() && (!i2p::context.IsFloodfill () || // non floodfill
|
||||||
|
(CreateRoutingKey (it.second->GetIdentHash ()) ^ i2p::context.GetIdentHash ()).metric[0] >= 0x02)) // different first 7 bits
|
||||||
|
it.second->SetUnreachable (true);
|
||||||
}
|
}
|
||||||
if (it.second->IsUnreachable () && i2p::transport::transports.IsConnected (it.second->GetIdentHash ()))
|
if (it.second->IsUnreachable () && i2p::transport::transports.IsConnected (it.second->GetIdentHash ()))
|
||||||
it.second->SetUnreachable (false); // don't expire connected router
|
it.second->SetUnreachable (false); // don't expire connected router
|
||||||
|
Loading…
x
Reference in New Issue
Block a user