squash commits

pull/1168/head
Jeff Becker 4 years ago
parent ac80357552
commit 7ba30eec25
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -146,11 +146,10 @@ namespace llarp
return;
util::Lock l(_mutex);
m_PersistingSessions[remote] =
std::max(until, m_PersistingSessions[remote]);
LogDebug("persist session to ", remote, " until ",
m_PersistingSessions[remote].count());
auto &curr = m_PersistingSessions[remote];
if(until > curr)
curr = until;
LogDebug("persist session to ", remote, " until ", curr - time_now_ms());
}
void
@ -307,7 +306,6 @@ namespace llarp
auto link = GetLinkWithSessionTo(itr->first);
if(link)
{
LogDebug("keepalive to ", itr->first);
link->KeepAliveSessionTo(itr->first);
}
else

@ -267,7 +267,11 @@ namespace llarp
{
Lock_t l(m_AuthedLinksMutex);
if(m_AuthedLinks.count(rc.pubkey) >= MaxSessionsPerKey)
{
LogDebug("Too many links to ", RouterID{rc.pubkey},
", not establishing another one");
return false;
}
}
llarp::AddressInfo to;
if(!PickAddress(rc, to))
@ -276,7 +280,12 @@ namespace llarp
{
Lock_t l(m_PendingMutex);
if(m_Pending.count(addr) >= MaxSessionsPerKey)
{
LogDebug("Too many pending connections to ", addr,
" while establishing to ", RouterID{rc.pubkey},
", not establishing another");
return false;
}
}
std::shared_ptr< ILinkSession > s = NewOutboundSession(rc, to);
if(PutSession(s))
@ -385,7 +394,10 @@ namespace llarp
while(itr != range.second)
{
if(itr->second->ShouldPing())
{
LogDebug("keepalive to ", remote);
itr->second->SendKeepAlive();
}
++itr;
}
}

@ -69,9 +69,6 @@ namespace llarp
bool
HasSessionTo(const RouterID& pk);
bool
HasSessionVia(const Addr& addr);
void
ForEachSession(std::function< void(const ILinkSession*) > visit,
bool randomize = false) const EXCLUDES(m_AuthedLinksMutex);

@ -379,11 +379,13 @@ namespace llarp
bool
Addr::operator==(const Addr& other) const
{
if(af() == AF_INET && other.af() == AF_INET)
return port() == other.port() && addr4()->s_addr == other.addr4()->s_addr;
if(af() != other.af() || port() != other.port())
return false;
return af() == other.af() && memcmp(addr6(), other.addr6(), 16) == 0
&& port() == other.port();
if(af() == AF_INET)
return addr4()->s_addr == other.addr4()->s_addr;
return memcmp(addr6(), other.addr6(), 16) == 0;
}
Addr&

Loading…
Cancel
Save