don't defer call to ready hook with timer call it right away because we are ready

pull/1649/head
Jeff Becker 3 years ago
parent 432e7f2a5a
commit f172db75c5
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -348,26 +348,14 @@ namespace llarp
if (ReadyToSend() and m_ReadyHook)
{
KeepAlive();
const auto path = GetPathByRouter(remoteIntro.router);
if (not path)
{
LogWarn(Name(), " ready but no path to ", remoteIntro.router, " ???");
return false;
return true;
}
const auto rtt = (path->intro.latency + remoteIntro.latency) * 2;
m_router->loop()->call_later(
rtt, [rtt, self = shared_from_this(), hook = std::move(m_ReadyHook)]() {
LogInfo(
self->Name(),
" is ready, RTT is measured as ",
self->estimatedRTT,
" approximated as ",
rtt,
" delta=",
rtt - self->estimatedRTT);
hook(self.get());
});
m_ReadyHook(this);
m_ReadyHook = nullptr;
}
if (lastGoodSend > 0s and now >= lastGoodSend + (sendTimeout / 2))

Loading…
Cancel
Save