Thu, 24 Sep 2009 23:46:12 +0100
net.dns: Remove elements from the cache when expired so as to not leave holes in the array
net/dns.lua | file | annotate | diff | comparison | revisions |
--- a/net/dns.lua Thu Sep 24 23:44:13 2009 +0100 +++ b/net/dns.lua Thu Sep 24 23:46:12 2009 +0100 @@ -95,7 +95,10 @@ if rr.tod then -- rr.tod = rr.tod - 50 -- accelerated decripitude rr.ttl = math.floor (rr.tod - time) - if rr.ttl <= 0 then rrs[i] = nil end + if rr.ttl <= 0 then + table.remove(rrs, i); + return prune(rrs, time, soft); -- Re-iterate + end elseif soft == 'soft' then -- What is this? I forget! assert (rr.ttl == 0)