mirror of https://github.com/oxen-io/lokinet
track client rcs
This commit is contained in:
parent
ab3d435d7f
commit
08d70e6d14
|
@ -509,6 +509,7 @@ namespace llarp
|
|||
static_cast< async_verify_context * >(job->user);
|
||||
auto router = ctx->router;
|
||||
PubKey pk(job->rc.pubkey);
|
||||
router->m_ClientRCs[pk] = job->rc;
|
||||
router->FlushOutboundFor(pk, router->GetLinkWithSessionByPubkey(pk));
|
||||
delete ctx;
|
||||
router->pendingVerifyRC.erase(pk);
|
||||
|
@ -1039,6 +1040,7 @@ namespace llarp
|
|||
}
|
||||
paths.TickPaths(now);
|
||||
paths.ExpirePaths(now);
|
||||
|
||||
{
|
||||
auto itr = m_PersistingSessions.begin();
|
||||
while(itr != m_PersistingSessions.end())
|
||||
|
@ -1051,7 +1053,7 @@ namespace llarp
|
|||
LogDebug("keepalive to ", itr->first);
|
||||
link->KeepAliveSessionTo(itr->first);
|
||||
}
|
||||
else
|
||||
else if(m_ClientRCs.count(itr->first) == 0)
|
||||
{
|
||||
LogDebug("establish to ", itr->first);
|
||||
TryEstablishTo(itr->first);
|
||||
|
@ -1146,9 +1148,11 @@ namespace llarp
|
|||
void
|
||||
Router::SessionClosed(RouterID remote)
|
||||
{
|
||||
__llarp_dht_remove_peer(dht(), remote.data());
|
||||
dht::Key_t k(remote);
|
||||
dht()->impl->Nodes()->DelNode(k);
|
||||
// remove from valid routers if it's a valid router
|
||||
validRouters.erase(remote);
|
||||
m_ClientRCs.erase(remote);
|
||||
LogInfo("Session to ", remote, " fully closed");
|
||||
}
|
||||
|
||||
|
|
|
@ -309,6 +309,9 @@ namespace llarp
|
|||
std::unordered_map< RouterID, llarp_time_t, RouterID::Hash >
|
||||
m_PersistingSessions;
|
||||
|
||||
// RCs of connected clients
|
||||
std::unordered_map< RouterID, RouterContact, RouterID::Hash > m_ClientRCs;
|
||||
|
||||
// lokinet routers from lokid, maps pubkey to when we think it will expire,
|
||||
// set to max value right now
|
||||
std::unordered_map< RouterID, llarp_time_t, PubKey::Hash > lokinetRouters;
|
||||
|
|
|
@ -82,6 +82,15 @@ namespace llarp
|
|||
{
|
||||
}
|
||||
|
||||
struct Hash
|
||||
{
|
||||
size_t
|
||||
operator()(const RouterContact &r) const
|
||||
{
|
||||
return PubKey::Hash()(r.pubkey);
|
||||
}
|
||||
};
|
||||
|
||||
// advertised addresses
|
||||
std::vector< AddressInfo > addrs;
|
||||
// network identifier
|
||||
|
|
Loading…
Reference in New Issue