aboutsummaryrefslogtreecommitdiffstats
path: root/net/dns.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-12-03 01:10:08 +0000
committerMatthew Wild <mwild1@gmail.com>2009-12-03 01:10:08 +0000
commit0ab240e0eb67622774b5a1c6f5b829db3a617721 (patch)
treefa3b265c2244bdf186719c3da0040985dfbc5da4 /net/dns.lua
parentb74d2847c0e893c9f189c47a184f63989b4108ab (diff)
downloadprosody-0ab240e0eb67622774b5a1c6f5b829db3a617721.tar.gz
prosody-0ab240e0eb67622774b5a1c6f5b829db3a617721.zip
net.dns: Port some DNS fixes to the resolver:feed() function for net.adns to use
Diffstat (limited to 'net/dns.lua')
-rw-r--r--net/dns.lua13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/dns.lua b/net/dns.lua
index c50e893c..bd2e6767 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -768,21 +768,18 @@ function resolver:feed(sock, packet)
self.time = socket.gettime();
local response = self:decode(packet);
- if response then
+ if response and self.active[response.header.id]
+ and self.active[response.header.id][response.question.raw] then
--print('received response');
--self.print(response);
- for i,section in pairs({ 'answer', 'authority', 'additional' }) do
- for j,rr in pairs(response[section]) do
- self:remember(rr, response.question[1].type);
- end
+ for j,rr in pairs(response.answer) do
+ self:remember(rr, response.question[1].type);
end
-- retire the query
local queries = self.active[response.header.id];
- if queries[response.question.raw] then
- queries[response.question.raw] = nil;
- end
+ queries[response.question.raw] = nil;
if not next(queries) then self.active[response.header.id] = nil; end
if not next(self.active) then self:closeall(); end