729 if response and self.active[response.header.id] |
729 if response and self.active[response.header.id] |
730 and self.active[response.header.id][response.question.raw] then |
730 and self.active[response.header.id][response.question.raw] then |
731 --print('received response'); |
731 --print('received response'); |
732 --self.print(response); |
732 --self.print(response); |
733 |
733 |
734 for i,section in pairs({ 'answer', 'authority', 'additional' }) do |
734 for j,rr in pairs(response.answer) do |
735 for j,rr in pairs(response[section]) do |
735 if rr.name:sub(-#response.question[1].name, -1) == response.question[1].name then |
736 self:remember(rr, response.question[1].type) |
736 self:remember(rr, response.question[1].type) |
737 end |
737 end |
738 end |
738 end |
739 |
739 |
740 -- retire the query |
740 -- retire the query |
741 local queries = self.active[response.header.id]; |
741 local queries = self.active[response.header.id]; |
742 if queries[response.question.raw] then |
742 queries[response.question.raw] = nil; |
743 queries[response.question.raw] = nil; |
743 |
744 end |
|
745 if not next(queries) then self.active[response.header.id] = nil; end |
744 if not next(queries) then self.active[response.header.id] = nil; end |
746 if not next(self.active) then self:closeall(); end |
745 if not next(self.active) then self:closeall(); end |
747 |
746 |
748 -- was the query on the wanted list? |
747 -- was the query on the wanted list? |
749 local q = response.question; |
748 local q = response.question; |