From: Remi Gacogne Date: Fri, 15 Dec 2023 09:21:34 +0000 (+0100) Subject: dnsdist: Fix clang-tidy warnings in the DownstreamState bindings X-Git-Tag: auth-4.9.0-alpha1~28^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f1f7f56613ac6d57d3ffa460ebe211113a6571a;p=thirdparty%2Fpdns.git dnsdist: Fix clang-tidy warnings in the DownstreamState bindings --- diff --git a/pdns/dnsdist-lua-bindings.cc b/pdns/dnsdist-lua-bindings.cc index 4d410c96f8..e25d74abe8 100644 --- a/pdns/dnsdist-lua-bindings.cc +++ b/pdns/dnsdist-lua-bindings.cc @@ -107,50 +107,50 @@ void setupLuaBindings(LuaContext& luaCtx, bool client, bool configCheck) #ifndef DISABLE_DOWNSTREAM_BINDINGS /* DownstreamState */ - luaCtx.registerFunction("setQPS", [](DownstreamState& s, int lim) { s.qps = lim ? QPSLimiter(lim, lim) : QPSLimiter(); }); - luaCtx.registerFunction::*)(string)>("addPool", [](std::shared_ptr s, string pool) { + luaCtx.registerFunction("setQPS", [](DownstreamState& state, int lim) { state.qps = lim ? QPSLimiter(lim, lim) : QPSLimiter(); }); + luaCtx.registerFunction::*)(string)>("addPool", [](std::shared_ptr state, string pool) { auto localPools = g_pools.getCopy(); - addServerToPool(localPools, pool, s); + addServerToPool(localPools, pool, state); g_pools.setState(localPools); - s->d_config.pools.insert(pool); + state->d_config.pools.insert(pool); }); - luaCtx.registerFunction::*)(string)>("rmPool", [](std::shared_ptr s, string pool) { + luaCtx.registerFunction::*)(string)>("rmPool", [](std::shared_ptr state, string pool) { auto localPools = g_pools.getCopy(); - removeServerFromPool(localPools, pool, s); + removeServerFromPool(localPools, pool, state); g_pools.setState(localPools); - s->d_config.pools.erase(pool); + state->d_config.pools.erase(pool); }); - luaCtx.registerFunction("getOutstanding", [](const DownstreamState& s) { return s.outstanding.load(); }); - luaCtx.registerFunction("getDrops", [](const DownstreamState& s) { return s.reuseds.load(); }); - luaCtx.registerFunction("getLatency", [](const DownstreamState& s) { return s.getRelevantLatencyUsec(); }); + luaCtx.registerFunction("getOutstanding", [](const DownstreamState& state) { return state.outstanding.load(); }); + luaCtx.registerFunction("getDrops", [](const DownstreamState& state) { return state.reuseds.load(); }); + luaCtx.registerFunction("getLatency", [](const DownstreamState& state) { return state.getRelevantLatencyUsec(); }); luaCtx.registerFunction("isUp", &DownstreamState::isUp); luaCtx.registerFunction("setDown", &DownstreamState::setDown); luaCtx.registerFunction("setUp", &DownstreamState::setUp); - luaCtx.registerFunction newStatus)>("setAuto", [](DownstreamState& s, boost::optional newStatus) { + luaCtx.registerFunction newStatus)>("setAuto", [](DownstreamState& state, boost::optional newStatus) { if (newStatus) { - s.setUpStatus(*newStatus); + state.setUpStatus(*newStatus); } - s.setAuto(); + state.setAuto(); }); - luaCtx.registerFunction newStatus)>("setLazyAuto", [](DownstreamState& s, boost::optional newStatus) { + luaCtx.registerFunction newStatus)>("setLazyAuto", [](DownstreamState& state, boost::optional newStatus) { if (newStatus) { - s.setUpStatus(*newStatus); + state.setUpStatus(*newStatus); } - s.setLazyAuto(); + state.setLazyAuto(); }); - luaCtx.registerFunction("getName", [](const DownstreamState& s) -> const std::string& { return s.getName(); }); - luaCtx.registerFunction("getNameWithAddr", [](const DownstreamState& s) -> const std::string& { return s.getNameWithAddr(); }); + luaCtx.registerFunction("getName", [](const DownstreamState& state) -> const std::string& { return state.getName(); }); + luaCtx.registerFunction("getNameWithAddr", [](const DownstreamState& state) -> const std::string& { return state.getNameWithAddr(); }); luaCtx.registerMember("upStatus", &DownstreamState::upStatus); luaCtx.registerMember("weight", - [](const DownstreamState& s) -> int {return s.d_config.d_weight;}, - [](DownstreamState& s, int newWeight) { s.setWeight(newWeight); } + [](const DownstreamState& state) -> int {return state.d_config.d_weight;}, + [](DownstreamState& state, int newWeight) { state.setWeight(newWeight); } ); luaCtx.registerMember("order", - [](const DownstreamState& s) -> int {return s.d_config.order; }, - [](DownstreamState& s, int newOrder) { s.d_config.order = newOrder; } + [](const DownstreamState& state) -> int {return state.d_config.order; }, + [](DownstreamState& state, int newOrder) { state.d_config.order = newOrder; } ); luaCtx.registerMember("name", [](const DownstreamState& backend) -> const std::string { return backend.getName(); }, [](DownstreamState& backend, const std::string& newName) { backend.setName(newName); }); - luaCtx.registerFunction("getID", [](const DownstreamState& s) { return boost::uuids::to_string(*s.d_config.id); }); + luaCtx.registerFunction("getID", [](const DownstreamState& state) { return boost::uuids::to_string(*state.d_config.id); }); #endif /* DISABLE_DOWNSTREAM_BINDINGS */ #ifndef DISABLE_DNSHEADER_BINDINGS