From f172db75c5f3ff89ec7a65252b62c1183778db32 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sun, 16 May 2021 19:31:59 -0400 Subject: [PATCH] don't defer call to ready hook with timer call it right away because we are ready --- llarp/service/outbound_context.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/llarp/service/outbound_context.cpp b/llarp/service/outbound_context.cpp index 741ddccf2..c24928d35 100644 --- a/llarp/service/outbound_context.cpp +++ b/llarp/service/outbound_context.cpp @@ -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))