Diff

net/dns.lua @ 1822:2f78ea5d0f11

net.dns: Remove elements from the cache when expired so as to not leave holes in the array
author Matthew Wild <mwild1@gmail.com>
date Thu, 24 Sep 2009 23:46:12 +0100
parent 1820:3e0e9f80010a
child 1823:7c3ec7ac6316
child 1827:fc21e8832848
line wrap: on
line diff
--- 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)