Software /
code /
prosody
Changeset
3325:b3117a1da834
net.dns, net.adns: Move coroutine-calling logic into resolver:cancel()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 05 Jul 2010 11:51:17 +0100 |
parents | 3324:070c8ba71b76 |
children | 3326:fb95015bc646 |
files | net/adns.lua net/dns.lua |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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