|
|
|
@ -171,10 +171,20 @@ namespace llarp
|
|
|
|
|
}
|
|
|
|
|
else if(m_SNodeKeys.find(pubKey) == m_SNodeKeys.end())
|
|
|
|
|
{
|
|
|
|
|
// we do not have it mapped
|
|
|
|
|
// map it
|
|
|
|
|
ip = ObtainServiceNodeIP(r);
|
|
|
|
|
msg.AddINReply(ip, isV6);
|
|
|
|
|
// we do not have it mapped, async obtain it
|
|
|
|
|
ObtainSNodeSession(
|
|
|
|
|
r, [&](std::shared_ptr< exit::BaseSession > session) {
|
|
|
|
|
if(session && session->IsReady())
|
|
|
|
|
{
|
|
|
|
|
msg.AddINReply(m_KeyToIP[pubKey], isV6);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
msg.AddNXReply();
|
|
|
|
|
}
|
|
|
|
|
reply(msg);
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -196,6 +206,14 @@ namespace llarp
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ExitEndpoint::ObtainSNodeSession(const RouterID &router,
|
|
|
|
|
exit::SessionReadyFunc obtainCb)
|
|
|
|
|
{
|
|
|
|
|
ObtainServiceNodeIP(router);
|
|
|
|
|
m_SNodeSessions[router]->AddReadyHook(obtainCb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
llarp_time_t
|
|
|
|
|
ExitEndpoint::Now() const
|
|
|
|
|
{
|
|
|
|
|