net.dns: Remove elements from the cache when expired so as to not leave holes in the array

Thu, 24 Sep 2009 23:46:12 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 24 Sep 2009 23:46:12 +0100
changeset 1822
2f78ea5d0f11
parent 1821
05ed826da89b
child 1823
7c3ec7ac6316
child 1824
fc21e8832848

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)

mercurial