|
|
|
@ -622,8 +622,8 @@ namespace data
@@ -622,8 +622,8 @@ namespace data
|
|
|
|
|
i2p::config::GetOption("limits.zombies", minTunnelCreationSuccessRate); |
|
|
|
|
bool isLowRate = i2p::tunnel::tunnels.GetPreciseTunnelCreationSuccessRate () < minTunnelCreationSuccessRate; |
|
|
|
|
// routers don't expire if less than 90 or uptime is less than 1 hour
|
|
|
|
|
bool checkForExpiration = total > NETDB_MIN_ROUTERS && uptime > 600; // 10 minutes
|
|
|
|
|
if (checkForExpiration && uptime > 3600) // 1 hour
|
|
|
|
|
bool checkForExpiration = total > NETDB_MIN_ROUTERS && uptime > NETDB_CHECK_FOR_EXPIRATION_UPTIME; // 10 minutes
|
|
|
|
|
if (checkForExpiration && uptime > i2p::transport::SSU2_TO_INTRODUCER_SESSION_DURATION) // 1 hour
|
|
|
|
|
expirationTimeout = i2p::context.IsFloodfill () ? NETDB_FLOODFILL_EXPIRATION_TIMEOUT*1000LL : |
|
|
|
|
NETDB_MIN_EXPIRATION_TIMEOUT*1000LL + (NETDB_MAX_EXPIRATION_TIMEOUT - NETDB_MIN_EXPIRATION_TIMEOUT)*1000LL*NETDB_MIN_ROUTERS/total; |
|
|
|
|
|
|
|
|
@ -1268,8 +1268,10 @@ namespace data
@@ -1268,8 +1268,10 @@ namespace data
|
|
|
|
|
std::shared_ptr<const RouterInfo> NetDb::GetHighBandwidthRandomRouter (std::shared_ptr<const RouterInfo> compatibleWith, |
|
|
|
|
bool reverse, bool endpoint) const |
|
|
|
|
{ |
|
|
|
|
bool checkIsReal = i2p::tunnel::tunnels.GetPreciseTunnelCreationSuccessRate () < NETDB_TUNNEL_CREATION_RATE_THRESHOLD && // too low rate
|
|
|
|
|
context.GetUptime () > NETDB_CHECK_FOR_EXPIRATION_UPTIME; // after 10 minutes uptime
|
|
|
|
|
return GetRandomRouter ( |
|
|
|
|
[compatibleWith, reverse, endpoint](std::shared_ptr<const RouterInfo> router)->bool |
|
|
|
|
[compatibleWith, reverse, endpoint, checkIsReal](std::shared_ptr<const RouterInfo> router)->bool |
|
|
|
|
{ |
|
|
|
|
return !router->IsHidden () && router != compatibleWith && |
|
|
|
|
(reverse ? (compatibleWith->IsReachableFrom (*router) && router->GetCompatibleTransports (true)) : |
|
|
|
@ -1277,6 +1279,7 @@ namespace data
@@ -1277,6 +1279,7 @@ namespace data
|
|
|
|
|
(router->GetCaps () & RouterInfo::eHighBandwidth) && |
|
|
|
|
router->GetVersion () >= NETDB_MIN_HIGHBANDWIDTH_VERSION && |
|
|
|
|
router->IsECIES () && !router->IsHighCongestion (true) && |
|
|
|
|
(!checkIsReal || router->GetProfile ()->IsReal ()) && |
|
|
|
|
(!endpoint || (router->IsV4 () && (!reverse || router->IsPublished (true)))); // endpoint must be ipv4 and published if inbound(reverse)
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|