aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2014-07-25 13:02:46 +0100
committerMatthew Wild <mwild1@gmail.com>2014-07-25 13:02:46 +0100
commit8a4ed9466f3b877d7a6e2c87f1cbec73c4a3c516 (patch)
tree56c01e1263e5c9fb3d1b580179e3bbaf119530b3
parentbb40012ca2d5a7eb38d86f4cef5488b31f6da0d0 (diff)
parent999a5a0cb3e13f5922d5c64418162ff463f1abd7 (diff)
downloadprosody-8a4ed9466f3b877d7a6e2c87f1cbec73c4a3c516.tar.gz
prosody-8a4ed9466f3b877d7a6e2c87f1cbec73c4a3c516.zip
Merge 0.10->trunk
-rw-r--r--net/dns.lua15
-rw-r--r--plugins/mod_admin_telnet.lua4
2 files changed, 8 insertions, 11 deletions
diff --git a/net/dns.lua b/net/dns.lua
index 088067ae..42bbdb01 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -752,7 +752,6 @@ function resolver:query(qname, qtype, qclass) -- - - - - - - - - - -- query
-- 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 @@ function resolver:query(qname, qtype, qclass) -- - - - - - - - - - -- query
end
end
-- Tried everything, failed
- self:cancel(qclass, qtype, qname, co, true);
+ self:cancel(qclass, qtype, qname);
end
end)
end
@@ -865,7 +864,6 @@ function resolver:receive(rset) -- - - - - - - - - - - - - - - - - receive
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 @@ function resolver:feed(sock, packet, force)
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 @@ function resolver:feed(sock, packet, force)
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 @@ end
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' });
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 0b96b68d..d20bcc7b 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -1073,12 +1073,12 @@ function def_env.dns:lookup(name, typ, class)
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