From 271eb117a780564339079461087b4c5f288984f4 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 1 Mar 2022 14:36:41 +0100 Subject: [PATCH] dnsdist: Do not execute 'newThread' in client and config check modes --- pdns/dnsdist-lua.cc | 5 ++++- pdns/dnsdistdist/docs/reference/config.rst | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 6820dccaf7..d7c94ddad2 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -2794,7 +2794,10 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) }); #endif /* HAVE_LIBSSL */ - luaCtx.writeFunction("newThread", [](const std::string& code) { + luaCtx.writeFunction("newThread", [client, configCheck](const std::string& code) { + if (client || configCheck) { + return; + } std::thread newThread(LuaThread, code); newThread.detach(); }); diff --git a/pdns/dnsdistdist/docs/reference/config.rst b/pdns/dnsdistdist/docs/reference/config.rst index c74ab9e21b..b7c4b89749 100644 --- a/pdns/dnsdistdist/docs/reference/config.rst +++ b/pdns/dnsdistdist/docs/reference/config.rst @@ -1608,6 +1608,7 @@ Other functions Spawns a separate thread running the supplied code. Code is supplied as a string, not as a function object. + Note that this function does nothing in 'client' or 'config-check' modes. .. function:: submitToMainThread(cmd, dict) -- 2.47.2