From 3e7137ad96f9382738a47c33977fa831b403c0c1 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 26 Apr 2021 06:19:46 -0400 Subject: [PATCH] fix regression: llarp::Context::CallSafe was not deferring call on startup --- llarp/context.cpp | 2 +- llarp/ev/ev_libuv.cpp | 1 + test/regress/2020-06-08-key-backup-bug.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/llarp/context.cpp b/llarp/context.cpp index c62d5893d..9bf260ce7 100644 --- a/llarp/context.cpp +++ b/llarp/context.cpp @@ -27,7 +27,7 @@ namespace llarp { if (!loop) return false; - loop->call(std::move(f)); + loop->call_soon(std::move(f)); return true; } diff --git a/llarp/ev/ev_libuv.cpp b/llarp/ev/ev_libuv.cpp index a1d7b330b..9832082d8 100644 --- a/llarp/ev/ev_libuv.cpp +++ b/llarp/ev/ev_libuv.cpp @@ -370,6 +370,7 @@ namespace llarp::uv { if (m_EventLoopThreadID) return *m_EventLoopThreadID == std::this_thread::get_id(); + // assume we are in it because we haven't started up yet return true; } diff --git a/test/regress/2020-06-08-key-backup-bug.cpp b/test/regress/2020-06-08-key-backup-bug.cpp index 0de1fc85b..e4ebfaa97 100644 --- a/test/regress/2020-06-08-key-backup-bug.cpp +++ b/test/regress/2020-06-08-key-backup-bug.cpp @@ -6,7 +6,7 @@ llarp::RuntimeOptions opts = {false, false, false}; -/// make a llarp_main* with 1 endpoint that specifies a keyfile +/// make a context with 1 endpoint that specifies a keyfile static std::shared_ptr make_context(std::optional keyfile) {