Comparison

net/dns.lua @ 6309:b6f76a52eb36

net.dns: Ensure all pending requests get notified of a timeout when looking up a record (fix for d122420542fb)
author Matthew Wild <mwild1@gmail.com>
date Fri, 25 Jul 2014 12:08:07 +0100
parent 6288:d122420542fb
child 6310:d232bb1bbe1e
comparison
equal deleted inserted replaced
6297:5b298a6ecf0c 6309:b6f76a52eb36
768 conn:send(o.packet); 768 conn:send(o.packet);
769 return self.timeout; 769 return self.timeout;
770 end 770 end
771 end 771 end
772 -- Tried everything, failed 772 -- Tried everything, failed
773 self:cancel(qclass, qtype, qname, co, true); 773 self:cancel(qclass, qtype, qname);
774 end 774 end
775 end) 775 end)
776 end 776 end
777 return true; 777 return true;
778 end 778 end
908 end 908 end
909 909
910 return response; 910 return response;
911 end 911 end
912 912
913 function resolver:cancel(qclass, qtype, qname, co, call_handler) 913 function resolver:cancel(qclass, qtype, qname)
914 local cos = get(self.wanted, qclass, qtype, qname); 914 local cos = get(self.wanted, qclass, qtype, qname);
915 if cos then 915 if cos then
916 if call_handler then 916 for co in pairs(cos) do
917 coroutine.resume(co); 917 if coroutine.status(co) == "suspended" then coroutine.resume(co); end
918 end 918 end
919 cos[co] = nil; 919 set(self.wanted, qclass, qtype, qname, nil);
920 end 920 end
921 end 921 end
922 922
923 function resolver:pulse() -- - - - - - - - - - - - - - - - - - - - - pulse 923 function resolver:pulse() -- - - - - - - - - - - - - - - - - - - - - pulse
924 --print(':pulse'); 924 --print(':pulse');