]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: More clang-tidy fixes
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 15 Dec 2023 10:00:37 +0000 (11:00 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 15 Dec 2023 10:00:37 +0000 (11:00 +0100)
pdns/dnsdist-lua-bindings.cc

index e25d74abe8c3c06e8eb3b1c66bced59688b745e8..34a745bb6013ec7313b65bf7da98931047fd35db 100644 (file)
@@ -107,14 +107,14 @@ void setupLuaBindings(LuaContext& luaCtx, bool client, bool configCheck)
 
 #ifndef DISABLE_DOWNSTREAM_BINDINGS
   /* DownstreamState */
-  luaCtx.registerFunction<void(DownstreamState::*)(int)>("setQPS", [](DownstreamState& state, int lim) { state.qps = lim ? QPSLimiter(lim, lim) : QPSLimiter(); });
-  luaCtx.registerFunction<void(std::shared_ptr<DownstreamState>::*)(string)>("addPool", [](std::shared_ptr<DownstreamState> state, string pool) {
+  luaCtx.registerFunction<void(DownstreamState::*)(int)>("setQPS", [](DownstreamState& state, int lim) { state.qps = lim > 0 ? QPSLimiter(lim, lim) : QPSLimiter(); });
+  luaCtx.registerFunction<void(std::shared_ptr<DownstreamState>::*)(string)>("addPool", [](const std::shared_ptr<DownstreamState>& state, string pool) {
       auto localPools = g_pools.getCopy();
       addServerToPool(localPools, pool, state);
       g_pools.setState(localPools);
       state->d_config.pools.insert(pool);
     });
-  luaCtx.registerFunction<void(std::shared_ptr<DownstreamState>::*)(string)>("rmPool", [](std::shared_ptr<DownstreamState> state, string pool) {
+  luaCtx.registerFunction<void(std::shared_ptr<DownstreamState>::*)(string)>("rmPool", [](const std::shared_ptr<DownstreamState>& state, string pool) {
       auto localPools = g_pools.getCopy();
       removeServerFromPool(localPools, pool, state);
       g_pools.setState(localPools);