Comparison

net/dns.lua @ 6289:a29cc79295e6

Merge 0.9->0.10
author Kim Alvefur <zash@zash.se>
date Mon, 30 Jun 2014 13:11:01 +0200
parent 5776:bd0ff8ae98a8
parent 6288:d122420542fb
child 6312:1940a014aeca
comparison
equal deleted inserted replaced
6284:b49540983320 6289:a29cc79295e6
720 720
721 721
722 function resolver:query(qname, qtype, qclass) -- - - - - - - - - - -- query 722 function resolver:query(qname, qtype, qclass) -- - - - - - - - - - -- query
723 qname, qtype, qclass = standardize(qname, qtype, qclass) 723 qname, qtype, qclass = standardize(qname, qtype, qclass)
724 724
725 local co = coroutine.running();
726 local q = get(self.wanted, qclass, qtype, qname);
727 if co and q then
728 -- We are already waiting for a reply to an identical query.
729 set(self.wanted, qclass, qtype, qname, co, true);
730 return true;
731 end
732
725 if not self.server then self:adddefaultnameservers(); end 733 if not self.server then self:adddefaultnameservers(); end
726 734
727 local question = encodeQuestion(qname, qtype, qclass); 735 local question = encodeQuestion(qname, qtype, qclass);
728 local peek = self:peek (qname, qtype, qclass); 736 local peek = self:peek (qname, qtype, qclass);
729 if peek then return peek; end 737 if peek then return peek; end
740 -- remember the query 748 -- remember the query
741 self.active[id] = self.active[id] or {}; 749 self.active[id] = self.active[id] or {};
742 self.active[id][question] = o; 750 self.active[id][question] = o;
743 751
744 -- remember which coroutine wants the answer 752 -- remember which coroutine wants the answer
745 local co = coroutine.running();
746 if co then 753 if co then
747 set(self.wanted, qclass, qtype, qname, co, true); 754 set(self.wanted, qclass, qtype, qname, co, true);
748 --set(self.yielded, co, qclass, qtype, qname, true); 755 --set(self.yielded, co, qclass, qtype, qname, true);
749 end 756 end
750 757