net/dns.lua
changeset 7096 388281be2bc7
parent 7062 7ec52755622f
child 7101 5286e79c6829
child 8154 2c65f8be38aa
--- a/net/dns.lua	Thu Jan 21 22:21:19 2016 +0100
+++ b/net/dns.lua	Thu Jan 21 22:26:46 2016 +0100
@@ -763,16 +763,16 @@
 	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;