From e23e53d3b8d5af13e22fbbb41768e72790d91c3d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 5 Jul 2010 11:51:17 +0100 Subject: net.dns, net.adns: Move coroutine-calling logic into resolver:cancel() --- net/adns.lua | 7 ++----- net/dns.lua | 5 ++++- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'net') diff --git a/net/adns.lua b/net/adns.lua index 88d4b4b3..7fadbe3f 100644 --- a/net/adns.lua +++ b/net/adns.lua @@ -36,12 +36,9 @@ function lookup(handler, qname, qtype, qclass) 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 --git a/net/dns.lua b/net/dns.lua index 1b8a88fa..6a74abd8 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -830,9 +830,12 @@ function resolver:feed(sock, packet) 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 -- cgit v1.2.3