From: Remi Gacogne Date: Thu, 20 Oct 2022 12:59:32 +0000 (+0200) Subject: dnsdist: Prevent copies of the lazy health-check options X-Git-Tag: dnsdist-1.8.0-rc1~271^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F12065%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Prevent copies of the lazy health-check options As suggested by Aki Tuomi (thanks!). --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 758f928dbd..e5b31692f9 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -476,7 +476,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) } if (vars.count("healthCheckMode")) { - auto mode = boost::get(vars.at("healthCheckMode")); + const auto& mode = boost::get(vars.at("healthCheckMode")); if (pdns_iequals(mode, "auto")) { config.availability = DownstreamState::Availability::Auto; } @@ -527,25 +527,25 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) } if (vars.count("lazyHealthCheckSampleSize")) { - auto value = std::stoi(boost::get(vars.at("lazyHealthCheckSampleSize"))); + const auto& value = std::stoi(boost::get(vars.at("lazyHealthCheckSampleSize"))); checkParameterBound("lazyHealthCheckSampleSize", value); config.d_lazyHealthCheckSampleSize = value; } if (vars.count("lazyHealthCheckMinSampleCount")) { - auto value = std::stoi(boost::get(vars.at("lazyHealthCheckMinSampleCount"))); + const auto& value = std::stoi(boost::get(vars.at("lazyHealthCheckMinSampleCount"))); checkParameterBound("lazyHealthCheckMinSampleCount", value); config.d_lazyHealthCheckMinSampleCount = value; } if (vars.count("lazyHealthCheckThreshold")) { - auto value = std::stoi(boost::get(vars.at("lazyHealthCheckThreshold"))); + const auto& value = std::stoi(boost::get(vars.at("lazyHealthCheckThreshold"))); checkParameterBound("lazyHealthCheckThreshold", value, std::numeric_limits::max()); config.d_lazyHealthCheckThreshold = value; } if (vars.count("lazyHealthCheckFailedInterval")) { - auto value = std::stoi(boost::get(vars.at("lazyHealthCheckFailedInterval"))); + const auto& value = std::stoi(boost::get(vars.at("lazyHealthCheckFailedInterval"))); checkParameterBound("lazyHealthCheckFailedInterval", value); config.d_lazyHealthCheckFailedInterval = value; } @@ -555,13 +555,13 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) } if (vars.count("lazyHealthCheckMaxBackOff")) { - auto value = std::stoi(boost::get(vars.at("lazyHealthCheckMaxBackOff"))); + const auto& value = std::stoi(boost::get(vars.at("lazyHealthCheckMaxBackOff"))); checkParameterBound("lazyHealthCheckMaxBackOff", value); config.d_lazyHealthCheckMaxBackOff = value; } if (vars.count("lazyHealthCheckMode")) { - auto mode = boost::get(vars.at("lazyHealthCheckMode")); + const auto& mode = boost::get(vars.at("lazyHealthCheckMode")); if (pdns_iequals(mode, "TimeoutOnly")) { config.d_lazyHealthCheckMode = DownstreamState::LazyHealthCheckMode::TimeoutOnly; }