1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

make PumpLL idempotent to reduce cpu use a bit

This commit is contained in:
Jeff Becker 2021-11-09 11:20:53 -05:00
parent 1ddfb7420a
commit 22d4b88edc
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05
2 changed files with 13 additions and 8 deletions

View file

@ -69,6 +69,16 @@ namespace llarp
_running.store(false);
_lastTick = llarp::time_now_ms();
m_NextExploreAt = Clock_t::now();
m_Pump = _loop->make_waker([this]() {
llarp::LogTrace("Router::PumpLL() start");
if (_stopping.load())
return;
paths.PumpDownstream();
paths.PumpUpstream();
_outboundMessageHandler.Tick();
_linkManager.PumpLinks();
llarp::LogTrace("Router::PumpLL() end");
});
}
Router::~Router()
@ -245,14 +255,7 @@ namespace llarp
void
Router::PumpLL()
{
llarp::LogTrace("Router::PumpLL() start");
if (_stopping.load())
return;
paths.PumpDownstream();
paths.PumpUpstream();
_outboundMessageHandler.Tick();
_linkManager.PumpLinks();
llarp::LogTrace("Router::PumpLL() end");
m_Pump->Trigger();
}
bool

View file

@ -76,6 +76,8 @@ namespace llarp
path::BuildLimiter m_PathBuildLimiter;
std::shared_ptr<EventLoopWakeup> m_Pump;
path::BuildLimiter&
pathBuildLimiter() override
{