X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=net%2Fdns.lua;h=8f943793a47ba1737df6f901b095380b7c195d85;hb=409ea7826d085d86bce956ec741bc3df62feda02;hp=2c0089407dae66487e0644aaeb7c5c239fde0ba3;hpb=85c190e5c853a9013e93c34f5fccc4dc0f1a917b;p=prosody.git diff --git a/net/dns.lua b/net/dns.lua index 2c008940..8f943793 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -723,7 +723,7 @@ function resolver:receive(rset) -- - - - - - - - - - - - - - - - - receive for i,sock in pairs(rset) do if self.socketset[sock] then - local packet = sock:receive(); + local packet = sock.receive(); if packet then response = self:decode(packet); if response and self.active[response.header.id] @@ -745,7 +745,7 @@ function resolver:receive(rset) -- - - - - - - - - - - - - - - - - receive if not next(self.active) then self:closeall(); end -- was the query on the wanted list? - local q = response.question; + local q = response.question[1]; local cos = get(self.wanted, q.class, q.type, q.name); if cos then for co in pairs(cos) do @@ -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