]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Only update the DynBlock state holders when needed 6368/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 19 Mar 2018 18:03:11 +0000 (19:03 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 19 Mar 2018 18:03:11 +0000 (19:03 +0100)
pdns/dnsdist-lua.cc

index dfe31e4e056b827ea1bf8cdc0457b42f69cedfca..97f589fa11958a359994f55e9805fa7c89afff9c 100644 (file)
@@ -822,6 +822,9 @@ void setupLuaConfig(bool client)
 
   g_lua.writeFunction("addDynBlocks",
                       [](const std::unordered_map<ComboAddress,unsigned int, ComboAddress::addressOnlyHash, ComboAddress::addressOnlyEqual>& m, const std::string& msg, boost::optional<int> seconds, boost::optional<DNSAction::Action> action) {
+                           if (m.empty()) {
+                             return;
+                           }
                            setLuaSideEffect();
                           auto slow = g_dynblockNMG.getCopy();
                           struct timespec until, now;
@@ -852,6 +855,9 @@ void setupLuaConfig(bool client)
 
   g_lua.writeFunction("addDynBlockSMT",
                       [](const vector<pair<unsigned int, string> >&names, const std::string& msg, boost::optional<int> seconds, boost::optional<DNSAction::Action> action) {
+                           if (names.empty()) {
+                             return;
+                           }
                            setLuaSideEffect();
                           auto slow = g_dynblockSMT.getCopy();
                           struct timespec until, now;