Changeset

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
parents 1821:05ed826da89b
children 1823:7c3ec7ac6316 1827:fc21e8832848
files net/dns.lua
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
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)