Comparison

net/adns.lua @ 2652:cbc58fc170ad

net.adns: Fix potential traceback on DNS responses with libevent enabled (thanks Flo)
author Matthew Wild <mwild1@gmail.com>
date Tue, 16 Feb 2010 15:05:18 +0000
parent 2578:61e5eff54415
child 2661:be4b1e796bd2
comparison
equal deleted inserted replaced
2651:0c40e60a4367 2652:cbc58fc170ad
47 function new_async_socket(sock, resolver) 47 function new_async_socket(sock, resolver)
48 local peername = "<unknown>"; 48 local peername = "<unknown>";
49 local listener = {}; 49 local listener = {};
50 local handler = {}; 50 local handler = {};
51 function listener.onincoming(conn, data) 51 function listener.onincoming(conn, data)
52 dns.feed(handler, data); 52 if data then
53 dns.feed(handler, data);
54 end
53 end 55 end
54 function listener.ondisconnect(conn, err) 56 function listener.ondisconnect(conn, err)
55 log("warn", "DNS socket for %s disconnected: %s", peername, err); 57 log("warn", "DNS socket for %s disconnected: %s", peername, err);
56 local servers = resolver.server; 58 local servers = resolver.server;
57 if resolver.socketset[conn] == resolver.best_server and resolver.best_server == #servers then 59 if resolver.socketset[conn] == resolver.best_server and resolver.best_server == #servers then