Comparison

net/adns.lua @ 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
parent 2925:692b3c6c5bd2
child 3326:fb95015bc646
comparison
equal deleted inserted replaced
3324:070c8ba71b76 3325:b3117a1da834
34 log("error", "Error in DNS response handler: %s", tostring(err)); 34 log("error", "Error in DNS response handler: %s", tostring(err));
35 end 35 end
36 end)(dns.peek(qname, qtype, qclass)); 36 end)(dns.peek(qname, qtype, qclass));
37 end 37 end
38 38
39 function cancel(handle, call_handler) 39 function cancel(handle, call_handler, reason)
40 log("warn", "Cancelling DNS lookup for %s", tostring(handle[3])); 40 log("warn", "Cancelling DNS lookup for %s", tostring(handle[3]));
41 dns.cancel(handle); 41 dns.cancel(handle, call_handler);
42 if call_handler then
43 coroutine.resume(handle[4]);
44 end
45 end 42 end
46 43
47 function new_async_socket(sock, resolver) 44 function new_async_socket(sock, resolver)
48 local peername = "<unknown>"; 45 local peername = "<unknown>";
49 local listener = {}; 46 local listener = {};