Software /
code /
prosody
Comparison
net/dns.lua @ 2212:7cb6460b18d8
Merge with trunk.
author | Tobias Markmann <tm@ayena.de> |
---|---|
date | Thu, 19 Nov 2009 17:53:52 +0100 |
parent | 2082:1381b2071c2e |
child | 2278:8c10f13c0c20 |
child | 2762:2bddf8b766f7 |
child | 2856:70e6ea49aff3 |
comparison
equal
deleted
inserted
replaced
2211:6094a4e2b6f3 | 2212:7cb6460b18d8 |
---|---|
724 | 724 |
725 if self.socketset[sock] then | 725 if self.socketset[sock] then |
726 local packet = sock:receive(); | 726 local packet = sock:receive(); |
727 if packet then | 727 if packet then |
728 response = self:decode(packet); | 728 response = self:decode(packet); |
729 if response then | 729 if response and self.active[response.header.id] |
730 and self.active[response.header.id][response.question.raw] then | |
730 --print('received response'); | 731 --print('received response'); |
731 --self.print(response); | 732 --self.print(response); |
732 | 733 |
733 for i,section in pairs({ 'answer', 'authority', 'additional' }) do | 734 for j,rr in pairs(response.answer) do |
734 for j,rr in pairs(response[section]) do | 735 if rr.name:sub(-#response.question[1].name, -1) == response.question[1].name then |
735 self:remember(rr, response.question[1].type) | 736 self:remember(rr, response.question[1].type) |
736 end | 737 end |
737 end | 738 end |
738 | 739 |
739 -- retire the query | 740 -- retire the query |
740 local queries = self.active[response.header.id]; | 741 local queries = self.active[response.header.id]; |
741 if queries[response.question.raw] then | 742 queries[response.question.raw] = nil; |
742 queries[response.question.raw] = nil; | 743 |
743 end | |
744 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 |
745 if not next(self.active) then self:closeall(); end | 745 if not next(self.active) then self:closeall(); end |
746 | 746 |
747 -- was the query on the wanted list? | 747 -- was the query on the wanted list? |
748 local q = response.question; | 748 local q = response.question; |