bypass medium congestion(D) routers for client tunnels

This commit is contained in:
orignal 2023-04-10 23:04:38 -04:00
parent 572694b141
commit 4ebc7c970a
5 changed files with 25 additions and 12 deletions

View file

@ -753,14 +753,15 @@ namespace tunnel
return m_CustomPeerSelector != nullptr;
}
bool TunnelPool::ValidatePeers (std::vector<std::shared_ptr<const i2p::data::IdentityEx> >& peers)
bool TunnelPool::ValidatePeers (std::vector<std::shared_ptr<const i2p::data::IdentityEx> >& peers) const
{
bool highBandwidth = !IsExploratory ();
for (auto it: peers)
{
auto r = i2p::data::netdb.FindRouter (it->GetIdentHash ());
if (r)
{
if (r->IsHighCongestion ()) return false;
if (r->IsHighCongestion (highBandwidth)) return false;
it = r->GetIdentity (); // use identity from updated RouterInfo
}
}