# HG changeset patch # User Matthew Wild # Date 1253832372 -3600 # Node ID 2f78ea5d0f112d01c1e428688a71afc620648545 # Parent 05ed826da89b50489642cde27d5082da4f5b3fdb net.dns: Remove elements from the cache when expired so as to not leave holes in the array diff -r 05ed826da89b -r 2f78ea5d0f11 net/dns.lua --- 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)