Software /
code /
prosody
Changeset
6288:d122420542fb
net.dns: Fix duplicated cache insertions by limiting outstanding queries per name to one
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 30 Jun 2014 12:45:53 +0200 |
parents | 6287:a380b09649e6 |
children | 6289:a29cc79295e6 6297:5b298a6ecf0c |
files | net/dns.lua |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/net/dns.lua Wed Jun 25 15:33:49 2014 +0200 +++ b/net/dns.lua Mon Jun 30 12:45:53 2014 +0200 @@ -715,6 +715,14 @@ 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); @@ -735,7 +743,6 @@ 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);