if we have an inbound session don't fail with NoLink

pull/1693/head
Jeff Becker 3 years ago
parent a316f5f787
commit cf0349c259
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -259,16 +259,18 @@ namespace llarp
{
if (router == us or not _rcLookup->SessionIsAllowed(router))
return false;
if (_linkManager->HasSessionTo(router))
return false;
if (_router->IsServiceNode())
return true;
size_t numPending = 0;
{
util::Lock lock(_mutex);
if (pendingSessions.find(router) == pendingSessions.end())
numPending += pendingSessions.size();
}
if (_linkManager->HasOutboundSessionTo(router))
return false;
if (_router->IsServiceNode())
return true;
return _linkManager->NumberOfConnectedRouters() + numPending < maxConnectedRouters;
}

Loading…
Cancel
Save