Diff

net/dns.lua @ 7093:388281be2bc7

net.dns: Remember query only after it was sent, in case it was not (fixes #598)
author Kim Alvefur <zash@zash.se>
date Thu, 21 Jan 2016 22:26:46 +0100
parent 7059:7ec52755622f
child 7098:5286e79c6829
child 8151:2c65f8be38aa
line wrap: on
line diff
--- 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;