Diff

net/dns.lua @ 7098:5286e79c6829

Merge 0.9->0.10
author Kim Alvefur <zash@zash.se>
date Fri, 22 Jan 2016 14:49:05 +0100
parent 7061:eda0feeaf759
parent 7093:388281be2bc7
child 7322:addf60d25356
line wrap: on
line diff
--- a/net/dns.lua	Fri Jan 22 13:20:00 2016 +0000
+++ b/net/dns.lua	Fri Jan 22 14:49:05 2016 +0100
@@ -754,17 +754,17 @@
 	self.active[id] = self.active[id] or {};
 	self.active[id][question] = o;
 
-	-- remember which coroutine wants the answer
-	if co then
-		set(self.wanted, qclass, qtype, qname, co, true);
-	end
-
 	local conn, err = self:getsocket(o.server)
 	if not conn then
 		return nil, err;
 	end
 	conn:send (o.packet)
 
+	-- remember which coroutine wants the answer
+	if co then
+		set(self.wanted, qclass, qtype, qname, co, true);
+	end
+	
 	if timer and self.timeout then
 		local num_servers = #self.server;
 		local i = 1;
@@ -861,7 +861,7 @@
 					-- retire the query
 					local queries = self.active[response.header.id];
 					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
 
@@ -875,7 +875,7 @@
 						set(self.wanted, q.class, q.type, q.name, nil);
 					end
 				end
-
+				
 			end
 		end
 	end