Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
1821:05ed826da89b | 1822:2f78ea5d0f11 |
---|---|
93 for i,rr in pairs (rrs) do | 93 for i,rr in pairs (rrs) do |
94 | 94 |
95 if rr.tod then | 95 if rr.tod then |
96 -- rr.tod = rr.tod - 50 -- accelerated decripitude | 96 -- rr.tod = rr.tod - 50 -- accelerated decripitude |
97 rr.ttl = math.floor (rr.tod - time) | 97 rr.ttl = math.floor (rr.tod - time) |
98 if rr.ttl <= 0 then rrs[i] = nil end | 98 if rr.ttl <= 0 then |
99 table.remove(rrs, i); | |
100 return prune(rrs, time, soft); -- Re-iterate | |
101 end | |
99 | 102 |
100 elseif soft == 'soft' then -- What is this? I forget! | 103 elseif soft == 'soft' then -- What is this? I forget! |
101 assert (rr.ttl == 0) | 104 assert (rr.ttl == 0) |
102 rrs[i] = nil | 105 rrs[i] = nil |
103 end end end | 106 end end end |