aboutsummaryrefslogtreecommitdiffstats
path: root/net/dns.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-09-24 23:46:12 +0100
committerMatthew Wild <mwild1@gmail.com>2009-09-24 23:46:12 +0100
commit9118f712274368d5794fb8b8a2831f678ae1c15b (patch)
tree12a503adc44a563fe3b3183da299442e77a2bba7 /net/dns.lua
parent467f2e52aa1fe8399ce28e0c449cd44274f4f603 (diff)
downloadprosody-9118f712274368d5794fb8b8a2831f678ae1c15b.tar.gz
prosody-9118f712274368d5794fb8b8a2831f678ae1c15b.zip
net.dns: Remove elements from the cache when expired so as to not leave holes in the array
Diffstat (limited to 'net/dns.lua')
-rw-r--r--net/dns.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/dns.lua b/net/dns.lua
index 8448b7ca..d6462031 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -95,7 +95,10 @@ local function prune (rrs, time, soft) -- - - - - - - - - - - - - - - prune
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)