select different routers for peer test

This commit is contained in:
orignal 2021-04-17 14:33:53 -04:00
parent 5edb256990
commit d5b61ed544
3 changed files with 12 additions and 7 deletions

View file

@ -1149,12 +1149,13 @@ namespace data
});
}
std::shared_ptr<const RouterInfo> NetDb::GetRandomPeerTestRouter (bool v4) const
std::shared_ptr<const RouterInfo> NetDb::GetRandomPeerTestRouter (bool v4, const std::set<IdentHash>& excluded) const
{
return GetRandomRouter (
[v4](std::shared_ptr<const RouterInfo> router)->bool
[v4, &excluded](std::shared_ptr<const RouterInfo> router)->bool
{
return !router->IsHidden () && router->IsPeerTesting (v4);
return !router->IsHidden () && router->IsPeerTesting (v4) &&
!excluded.count (router->GetIdentHash ());
});
}