aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2014-06-30 13:11:01 +0200
committerKim Alvefur <zash@zash.se>2014-06-30 13:11:01 +0200
commit75c19f9f6c36cb2fb954973f11825513030c6e54 (patch)
tree797403783259bad9e629c25caf71f8f832d36f76 /net
parent265b49cc49438767327fc3468561a4fbcf484fe0 (diff)
parent7ef57da0477d5d0cad42f85c3a3027d35eae0968 (diff)
downloadprosody-75c19f9f6c36cb2fb954973f11825513030c6e54.tar.gz
prosody-75c19f9f6c36cb2fb954973f11825513030c6e54.zip
Merge 0.9->0.10
Diffstat (limited to 'net')
-rw-r--r--net/adns.lua1
-rw-r--r--net/dns.lua9
2 files changed, 9 insertions, 1 deletions
diff --git a/net/adns.lua b/net/adns.lua
index 08421f77..15814fe7 100644
--- a/net/adns.lua
+++ b/net/adns.lua
@@ -52,6 +52,7 @@ function new_async_socket(sock, resolver)
local peername = "<unknown>";
local listener = {};
local handler = {};
+ local err;
function listener.onincoming(conn, data)
if data then
dns.feed(handler, data);
diff --git a/net/dns.lua b/net/dns.lua
index bd5c260e..088067ae 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -722,6 +722,14 @@ end
function resolver:query(qname, qtype, qclass) -- - - - - - - - - - -- query
qname, qtype, qclass = standardize(qname, qtype, qclass)
+ local co = coroutine.running();
+ local q = get(self.wanted, qclass, qtype, qname);
+ if co and q then
+ -- We are already waiting for a reply to an identical query.
+ set(self.wanted, qclass, qtype, qname, co, true);
+ return true;
+ end
+
if not self.server then self:adddefaultnameservers(); end
local question = encodeQuestion(qname, qtype, qclass);
@@ -742,7 +750,6 @@ function resolver:query(qname, qtype, qclass) -- - - - - - - - - - -- query
self.active[id][question] = o;
-- remember which coroutine wants the answer
- local co = coroutine.running();
if co then
set(self.wanted, qclass, qtype, qname, co, true);
--set(self.yielded, co, qclass, qtype, qname, true);