# HG changeset patch # User Matthew Wild # Date 1278327077 -3600 # Node ID b3117a1da834bb4de130411e57a809f4c0e85e2d # Parent 070c8ba71b7656192a0c09f19ac2f909d4350857 net.dns, net.adns: Move coroutine-calling logic into resolver:cancel() diff -r 070c8ba71b76 -r b3117a1da834 net/adns.lua --- a/net/adns.lua Mon Jul 05 11:50:21 2010 +0100 +++ b/net/adns.lua Mon Jul 05 11:51:17 2010 +0100 @@ -36,12 +36,9 @@ end)(dns.peek(qname, qtype, qclass)); end -function cancel(handle, call_handler) +function cancel(handle, call_handler, reason) log("warn", "Cancelling DNS lookup for %s", tostring(handle[3])); - dns.cancel(handle); - if call_handler then - coroutine.resume(handle[4]); - end + dns.cancel(handle, call_handler); end function new_async_socket(sock, resolver) diff -r 070c8ba71b76 -r b3117a1da834 net/dns.lua --- a/net/dns.lua Mon Jul 05 11:50:21 2010 +0100 +++ b/net/dns.lua Mon Jul 05 11:51:17 2010 +0100 @@ -830,9 +830,12 @@ return response; end -function resolver:cancel(data) +function resolver:cancel(data, call_handler) local cos = get(self.wanted, unpack(data, 1, 3)); if cos then + if call_handler then + coroutine.resume(data[4]); + end cos[data[4]] = nil; end end