diff options
author | Kim Alvefur <zash@zash.se> | 2014-10-05 15:37:46 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2014-10-05 15:37:46 +0200 |
commit | 505ba5222550485aab2d062dc2bf6f7a5bc9b0b0 (patch) | |
tree | c419f2d0ba15e1d5364c44a1e2b6f89e99f16f85 /net | |
parent | f5f64c67636ac8bfc9e1add666229278c689bf0a (diff) | |
parent | 3ae8a2ed6ef23c1e7cea54a93b05c624a321cf08 (diff) | |
download | prosody-505ba5222550485aab2d062dc2bf6f7a5bc9b0b0.tar.gz prosody-505ba5222550485aab2d062dc2bf6f7a5bc9b0b0.zip |
Merge 0.10->trunk
Diffstat (limited to 'net')
-rw-r--r-- | net/dns.lua | 13 | ||||
-rw-r--r-- | net/server_select.lua | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/net/dns.lua b/net/dns.lua index 42bbdb01..2b03caf6 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -135,17 +135,19 @@ end local function prune(rrs, time, soft) -- - - - - - - - - - - - - - - prune time = time or socket.gettime(); - for i,rr in pairs(rrs) do + for i,rr in ipairs(rrs) do if rr.tod then -- rr.tod = rr.tod - 50 -- accelerated decripitude rr.ttl = math.floor(rr.tod - time); if rr.ttl <= 0 then + rrs[rr[rr.type:lower()]] = nil; 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); - rrs[i] = nil; + rrs[rr[rr.type:lower()]] = nil; + table.remove(rrs, i); end end end @@ -188,7 +190,7 @@ end local rrs_metatable = {}; -- - - - - - - - - - - - - - - - - - rrs_metatable function rrs_metatable.__tostring(rrs) local t = {}; - for i,rr in pairs(rrs) do + for i,rr in ipairs(rrs) do append(t, tostring(rr)..'\n'); end return table.concat(t); @@ -681,7 +683,10 @@ function resolver:remember(rr, type) -- - - - - - - - - - - - - - remember self.cache = self.cache or setmetatable({}, cache_metatable); local rrs = get(self.cache, qclass, type, qname) or set(self.cache, qclass, type, qname, setmetatable({}, rrs_metatable)); - append(rrs, rr); + if not rrs[rr[qtype:lower()]] then + rrs[rr[qtype:lower()]] = true; + append(rrs, rr); + end if type == 'MX' then self.unsorted[rrs] = true; end end diff --git a/net/server_select.lua b/net/server_select.lua index b9785678..51449bdf 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -888,6 +888,8 @@ loop = function(once) -- this is the main loop of the program if not(handler.onreadtimeout) or handler:onreadtimeout() ~= true then handler.disconnect( )( handler, "read timeout" ) handler:close( ) -- forced disconnect? + else + _readtimes[ handler ] = _currenttime -- reset timer end end end |