From 8780ba538c1bd45895371b7787b189f897a2b357 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 1 Dec 2015 18:43:56 +0100 Subject: [PATCH] Make getServer() return a dummy one in client mode. Closes #2976. --- pdns/dnsdist-lua.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index cfbb251d3a..544838eae6 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -514,7 +514,11 @@ vector> setupLua(bool client, const std::string& confi return getDownstreamCandidates(g_dstates.getCopy(), pool); }); - g_lua.writeFunction("getServer", [](int i) { return g_dstates.getCopy().at(i); }); + g_lua.writeFunction("getServer", [client](int i) { + if (client) + return std::make_shared(ComboAddress()); + return g_dstates.getCopy().at(i); + }); g_lua.registerFunction("setQPS", [](DownstreamState& s, int lim) { s.qps = lim ? QPSLimiter(lim, lim) : QPSLimiter(); }); g_lua.registerFunction("addPool", [](DownstreamState& s, string pool) { s.pools.insert(pool);}); -- 2.47.2