From 7a1207dc47570f6e25d933cefed860012ffe9e71 Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 21 Oct 2020 17:31:57 -0400 Subject: [PATCH] dont bind inbound links as client (#1419) * dont bind inbound links as client * fix broken test * logic call MUST defer call --- llarp/config/config.cpp | 10 +++++----- llarp/ev/ev_libuv.cpp | 7 +++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/llarp/config/config.cpp b/llarp/config/config.cpp index aeb33c15a..c52b36c53 100644 --- a/llarp/config/config.cpp +++ b/llarp/config/config.cpp @@ -712,8 +712,6 @@ namespace llarp void LinksConfig::defineConfigOptions(ConfigDefinition& conf, const ConfigGenParameters& params) { - (void)params; - constexpr Default DefaultOutboundLinkValue{"0"}; conf.addSectionComments( @@ -754,9 +752,11 @@ namespace llarp }, [this](std::string arg) { m_OutboundLink = LinkInfoFromINIValues("*", arg); }); - if (std::string best_if; GetBestNetIF(best_if)) - m_InboundLinks.push_back(LinkInfoFromINIValues(best_if, std::to_string(DefaultPublicPort))); - + if (params.isRelay) + { + if (std::string best_if; GetBestNetIF(best_if)) + m_InboundLinks.push_back(LinkInfoFromINIValues(best_if, std::to_string(DefaultPublicPort))); + } conf.addUndeclaredHandler( "bind", [&, defaulted = true]( diff --git a/llarp/ev/ev_libuv.cpp b/llarp/ev/ev_libuv.cpp index f0e1388f8..b5cef28d6 100644 --- a/llarp/ev/ev_libuv.cpp +++ b/llarp/ev/ev_libuv.cpp @@ -1081,12 +1081,11 @@ namespace libuv } const auto inEventLoop = *m_EventLoopThreadID == std::this_thread::get_id(); - if (inEventLoop) + if (inEventLoop and m_LogicCalls.full()) { - f(); + FlushLogic(); } - else - m_LogicCalls.pushBack(f); + m_LogicCalls.pushBack(f); uv_async_send(&m_WakeUp); }