Changeset

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
parents 7092:bee63de49663
children 7094:e8f202856fc0
files net/dns.lua
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
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;