Comparison

net/adns.lua @ 4103:c994524ef953

net.adns: Fix logging to handle unconnected UDP sockets
author Matthew Wild <mwild1@gmail.com>
date Sat, 08 Jan 2011 23:20:36 +0000
parent 4056:9106dcd4815e
child 5730:411e9e7d8035
comparison
equal deleted inserted replaced
4102:9df4e61c260b 4103:c994524ef953
77 handler.setsockname = function (_, ...) return sock:setsockname(...); end 77 handler.setsockname = function (_, ...) return sock:setsockname(...); end
78 handler.setpeername = function (_, ...) peername = (...); local ret = sock:setpeername(...); _:set_send(dummy_send); return ret; end 78 handler.setpeername = function (_, ...) peername = (...); local ret = sock:setpeername(...); _:set_send(dummy_send); return ret; end
79 handler.connect = function (_, ...) return sock:connect(...) end 79 handler.connect = function (_, ...) return sock:connect(...) end
80 --handler.send = function (_, data) _:write(data); return _.sendbuffer and _.sendbuffer(); end 80 --handler.send = function (_, data) _:write(data); return _.sendbuffer and _.sendbuffer(); end
81 handler.send = function (_, data) 81 handler.send = function (_, data)
82 log("debug", "Sending DNS query to %s", sock:getpeername()); 82 local getpeername = sock.getpeername;
83 log("debug", "Sending DNS query to %s", (getpeername and getpeername(sock)) or "<unconnected>");
83 return sock:send(data); 84 return sock:send(data);
84 end 85 end
85 return handler; 86 return handler;
86 end 87 end
87 88