]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Do not execute 'newThread' in client and config check modes 11258/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 1 Mar 2022 13:36:41 +0000 (14:36 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 1 Feb 2022 13:36:41 +0000 (14:36 +0100)
pdns/dnsdist-lua.cc
pdns/dnsdistdist/docs/reference/config.rst

index 6820dccaf76e3234728aa82e86253db27e97f511..d7c94ddad2219e4fcab86bef69b9b0090d6a9b76 100644 (file)
@@ -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();
   });
index c74ab9e21b350f0d52277dde0bed43a1d145c871..b7c4b8974937fa2b35e430d807011e55d29124f7 100644 (file)
@@ -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)