|
|
@ -152,6 +152,8 @@ llarp_router::PersistSessionUntil(const llarp::RouterID &remote,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constexpr size_t MaxPendingSendQueueSize = 8;
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
llarp_router::SendToOrQueue(const llarp::RouterID &remote,
|
|
|
|
llarp_router::SendToOrQueue(const llarp::RouterID &remote,
|
|
|
|
const llarp::ILinkMessage *msg)
|
|
|
|
const llarp::ILinkMessage *msg)
|
|
|
@ -181,6 +183,14 @@ llarp_router::SendToOrQueue(const llarp::RouterID &remote,
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
// queue buffer
|
|
|
|
// queue buffer
|
|
|
|
auto &q = outboundMessageQueue[remote];
|
|
|
|
auto &q = outboundMessageQueue[remote];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(q.size() >= MaxPendingSendQueueSize)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
llarp::LogWarn("tried to queue a message to ", remote,
|
|
|
|
|
|
|
|
" but the queue is full so we drop it like it's hawt");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buf.sz = buf.cur - buf.base;
|
|
|
|
buf.sz = buf.cur - buf.base;
|
|
|
|
q.emplace(buf.sz);
|
|
|
|
q.emplace(buf.sz);
|
|
|
|
memcpy(q.back().data(), buf.base, buf.sz);
|
|
|
|
memcpy(q.back().data(), buf.base, buf.sz);
|
|
|
@ -726,6 +736,18 @@ llarp_router::Run()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// we are a client
|
|
|
|
|
|
|
|
// regenerate keys and resign rc before everything else
|
|
|
|
|
|
|
|
crypto.identity_keygen(identity);
|
|
|
|
|
|
|
|
crypto.encryption_keygen(encryption);
|
|
|
|
|
|
|
|
_rc.pubkey = llarp::seckey_topublic(identity);
|
|
|
|
|
|
|
|
_rc.enckey = llarp::seckey_topublic(encryption);
|
|
|
|
|
|
|
|
if(!_rc.Sign(&crypto, identity))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
llarp::LogError("failed to regenerate keys and sign RC");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// delayed connect all for clients
|
|
|
|
// delayed connect all for clients
|
|
|
|
uint64_t delay = ((llarp_randint() % 10) * 500) + 500;
|
|
|
|
uint64_t delay = ((llarp_randint() % 10) * 500) + 500;
|
|
|
|
llarp_logic_call_later(logic, {delay, this, &ConnectAll});
|
|
|
|
llarp_logic_call_later(logic, {delay, this, &ConnectAll});
|
|
|
|