Diff

net/dns.lua @ 2300:e182b5029ef2

net.dns: Port some DNS fixes to the resolver:feed() function for net.adns to use
author Matthew Wild <mwild1@gmail.com>
date Thu, 03 Dec 2009 01:10:08 +0000
parent 2278:8c10f13c0c20
child 2301:8a01b0898679
line wrap: on
line diff
--- a/net/dns.lua	Wed Dec 02 22:15:17 2009 +0000
+++ b/net/dns.lua	Thu Dec 03 01:10:08 2009 +0000
@@ -768,21 +768,18 @@
 	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