simplify logic

This commit is contained in:
Jeff Becker 2020-03-08 08:09:48 -04:00
parent 327ab6f178
commit d8da3f0a83
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
1 changed files with 10 additions and 19 deletions

View File

@ -726,25 +726,16 @@ namespace llarp
GossipRCIfNeeded(_rc);
}
if(isSvcNode && _rcLookupHandler.HaveReceivedWhitelist())
{
// remove RCs for nodes that are no longer allowed by network policy
nodedb()->RemoveIf([&](const RouterContact &rc) -> bool {
if(IsBootstrapNode(rc.pubkey))
return false;
if(not rc.IsPublicRouter())
return true;
return !_rcLookupHandler.RemoteIsAllowed(rc.pubkey);
});
}
else
{
nodedb()->RemoveIf([&](const RouterContact &rc) -> bool {
if(IsBootstrapNode(rc.pubkey))
return false;
return not rc.IsPublicRouter();
});
}
// remove RCs for nodes that are no longer allowed by network policy
nodedb()->RemoveIf([&](const RouterContact &rc) -> bool {
if(IsBootstrapNode(rc.pubkey))
return false;
if(not rc.IsPublicRouter())
return true;
if(not isSvcNode)
return false;
return not _rcLookupHandler.RemoteIsAllowed(rc.pubkey);
});
_linkManager.CheckPersistingSessions(now);