# HG changeset patch # User Matthew Wild # Date 1278327946 -3600 # Node ID fb95015bc6460123d59e636d6dc4492a3f7f7f91 # Parent b3117a1da834bb4de130411e57a809f4c0e85e2d 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 diff -r b3117a1da834 -r fb95015bc646 net/adns.lua --- a/net/adns.lua Mon Jul 05 11:51:17 2010 +0100 +++ b/net/adns.lua Mon Jul 05 12:05:46 2010 +0100 @@ -38,7 +38,7 @@ function cancel(handle, call_handler, reason) log("warn", "Cancelling DNS lookup for %s", tostring(handle[3])); - dns.cancel(handle, call_handler); + dns.cancel(handle[1], handle[2], handle[3], handle[4], call_handler); end function new_async_socket(sock, resolver) diff -r b3117a1da834 -r fb95015bc646 net/dns.lua --- a/net/dns.lua Mon Jul 05 11:51:17 2010 +0100 +++ b/net/dns.lua Mon Jul 05 12:05:46 2010 +0100 @@ -698,7 +698,7 @@ return dns_timeout; else -- Tried everything, failed - resolver:cancel({qclass, qtype, qname, co}, true); + resolver:cancel(qclass, qtype, qname, co, true); end end end) @@ -830,13 +830,13 @@ return response; end -function resolver:cancel(data, call_handler) - local cos = get(self.wanted, unpack(data, 1, 3)); +function resolver:cancel(qclass, qtype, qname, co, call_handler) + local cos = get(self.wanted, qclass, qtype, qname); if cos then if call_handler then - coroutine.resume(data[4]); + coroutine.resume(co); end - cos[data[4]] = nil; + cos[co] = nil; end end