]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lua/trust_anchors: idempotent config()
authorMarek Vavruša <marek.vavrusa@nic.cz>
Mon, 28 Sep 2015 15:11:38 +0000 (17:11 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Mon, 28 Sep 2015 15:11:38 +0000 (17:11 +0200)
daemon/lua/trust_anchors.lua

index cfc7a9ecc55b2c89354f48a38d31862898f39159..98fce1aa9d21b3f900165ab35992a852d6f7b2e7 100644 (file)
@@ -95,7 +95,9 @@ local function refresh_plan(trust_anchors, timeout, refresh_cb)
                function (pkt)
                        -- Schedule itself with updated timeout
                        local next_time = refresh_cb(trust_anchors, kres.pkt_t(pkt))
-                       next_time = math.min(next_time, trust_anchors.refresh_time)
+                       if trust_anchors.refresh_time ~= nil then
+                               next_time = math.min(next_time, trust_anchors.refresh_time)
+                       end
                        print('[trust_anchors] next refresh: '..next_time)
                        refresh_plan(trust_anchors, next_time, refresh_cb)
                end)
@@ -190,6 +192,7 @@ local trust_anchors = {
        end,
        -- Load keys from a file (managed)
        config = function (path, is_unmanaged)
+               if path == trust_anchors.file_current then return end
                local new_keys = require('zonefile').parse_file(path)
                trust_anchors.file_current = path
                if is_unmanaged then trust_anchors.file_current = nil end