net.dns: Return new socket from servfail
authorKim Alvefur <zash@zash.se>
Thu, 30 Oct 2014 12:10:15 +0100
changeset 6511 4a28b8320d7f
parent 6510 84ca02c6a47e
child 6512 7cb69eba3e95
net.dns: Return new socket from servfail
net/dns.lua
--- a/net/dns.lua	Thu Oct 30 12:08:05 2014 +0100
+++ b/net/dns.lua	Thu Oct 30 12:10:15 2014 +0100
@@ -787,7 +787,7 @@
 	local num = self.socketset[sock]
 
 	-- Socket is dead now
-	self:voidsocket(sock);
+	sock = self:voidsocket(sock);
 
 	-- Find all requests to the down server, and retry on the next server
 	self.time = socket.gettime();
@@ -804,8 +804,8 @@
 					--print('timeout');
 					queries[question] = nil;
 				else
-					local _a = self:getsocket(o.server);
-					if _a then _a:send(o.packet); end
+					sock = self:getsocket(o.server);
+					if sock then sock:send(o.packet); end
 				end
 			end
 		end
@@ -821,6 +821,7 @@
 			self.best_server = 1;
 		end
 	end
+	return sock;
 end
 
 function resolver:settimeout(seconds)