Changeset

6312:1940a014aeca

Merge 0.9->0.10
author Matthew Wild <mwild1@gmail.com>
date Fri, 25 Jul 2014 13:01:57 +0100
parents 6306:c6d9e21cd5f2 (current diff) 6311:f44876548487 (diff)
children 6313:8bd486b6e5ec 6315:7a3e2f2d43fc
files net/dns.lua plugins/mod_admin_telnet.lua
diffstat 2 files changed, 8 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/net/dns.lua	Wed Jul 09 02:04:16 2014 +0200
+++ b/net/dns.lua	Fri Jul 25 13:01:57 2014 +0100
@@ -752,7 +752,6 @@
 	-- remember which coroutine wants the answer
 	if co then
 		set(self.wanted, qclass, qtype, qname, co, true);
-		--set(self.yielded, co, qclass, qtype, qname, true);
 	end
 
 	local conn, err = self:getsocket(o.server)
@@ -777,7 +776,7 @@
 					end
 				end
 				-- Tried everything, failed
-				self:cancel(qclass, qtype, qname, co, true);
+				self:cancel(qclass, qtype, qname);
 			end
 		end)
 	end
@@ -865,7 +864,6 @@
 					local cos = get(self.wanted, q.class, q.type, q.name);
 					if cos then
 						for co in pairs(cos) do
-							set(self.yielded, co, q.class, q.type, q.name, nil);
 							if coroutine.status(co) == "suspended" then coroutine.resume(co); end
 						end
 						set(self.wanted, q.class, q.type, q.name, nil);
@@ -906,7 +904,6 @@
 			local cos = get(self.wanted, q.class, q.type, q.name);
 			if cos then
 				for co in pairs(cos) do
-					set(self.yielded, co, q.class, q.type, q.name, nil);
 					if coroutine.status(co) == "suspended" then coroutine.resume(co); end
 				end
 				set(self.wanted, q.class, q.type, q.name, nil);
@@ -917,13 +914,13 @@
 	return response;
 end
 
-function resolver:cancel(qclass, qtype, qname, co, call_handler)
+function resolver:cancel(qclass, qtype, qname)
 	local cos = get(self.wanted, qclass, qtype, qname);
 	if cos then
-		if call_handler then
-			coroutine.resume(co);
+		for co in pairs(cos) do
+			if coroutine.status(co) == "suspended" then coroutine.resume(co); end
 		end
-		cos[co] = nil;
+		set(self.wanted, qclass, qtype, qname, nil);
 	end
 end
 
@@ -1044,7 +1041,7 @@
 function dns.resolver ()    -- - - - - - - - - - - - - - - - - - - - - resolver
 	-- this function seems to be redundant with resolver.new ()
 
-	local r = { active = {}, cache = {}, unsorted = {}, wanted = {}, yielded = {}, best_server = 1 };
+	local r = { active = {}, cache = {}, unsorted = {}, wanted = {}, best_server = 1 };
 	setmetatable (r, resolver);
 	setmetatable (r.cache, cache_metatable);
 	setmetatable (r.unsorted, { __mode = 'kv' });
--- a/plugins/mod_admin_telnet.lua	Wed Jul 09 02:04:16 2014 +0200
+++ b/plugins/mod_admin_telnet.lua	Fri Jul 25 13:01:57 2014 +0100
@@ -1073,12 +1073,12 @@
 end
 
 function def_env.dns:addnameserver(...)
-	dns.addnameserver(...)
+	dns._resolver:addnameserver(...)
 	return true
 end
 
 function def_env.dns:setnameserver(...)
-	dns.setnameserver(...)
+	dns._resolver:setnameserver(...)
 	return true
 end