Software /
code /
prosody
Comparison
net/dns.lua @ 3326:fb95015bc646
net.dns, net.adns: Update resolver:cancel() API so that a table doesn't need to be created for each cancellation internal to net.dns
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 05 Jul 2010 12:05:46 +0100 |
parent | 3325:b3117a1da834 |
child | 3327:b447682f2a8d |
comparison
equal
deleted
inserted
replaced
3325:b3117a1da834 | 3326:fb95015bc646 |
---|---|
696 conn = self:getsocket(o.server); | 696 conn = self:getsocket(o.server); |
697 conn:send(o.packet); | 697 conn:send(o.packet); |
698 return dns_timeout; | 698 return dns_timeout; |
699 else | 699 else |
700 -- Tried everything, failed | 700 -- Tried everything, failed |
701 resolver:cancel({qclass, qtype, qname, co}, true); | 701 resolver:cancel(qclass, qtype, qname, co, true); |
702 end | 702 end |
703 end | 703 end |
704 end) | 704 end) |
705 end | 705 end |
706 end | 706 end |
828 end | 828 end |
829 | 829 |
830 return response; | 830 return response; |
831 end | 831 end |
832 | 832 |
833 function resolver:cancel(data, call_handler) | 833 function resolver:cancel(qclass, qtype, qname, co, call_handler) |
834 local cos = get(self.wanted, unpack(data, 1, 3)); | 834 local cos = get(self.wanted, qclass, qtype, qname); |
835 if cos then | 835 if cos then |
836 if call_handler then | 836 if call_handler then |
837 coroutine.resume(data[4]); | 837 coroutine.resume(co); |
838 end | 838 end |
839 cos[data[4]] = nil; | 839 cos[co] = nil; |
840 end | 840 end |
841 end | 841 end |
842 | 842 |
843 function resolver:pulse() -- - - - - - - - - - - - - - - - - - - - - pulse | 843 function resolver:pulse() -- - - - - - - - - - - - - - - - - - - - - pulse |
844 --print(':pulse'); | 844 --print(':pulse'); |