Changeset

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
parents 2299:b7d25e1ac716
children 2301:8a01b0898679
files net/dns.lua
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
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