Software /
code /
prosody
Diff
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 |
line wrap: on
line diff
--- a/net/adns.lua Sat Jan 08 23:20:16 2011 +0000 +++ b/net/adns.lua Sat Jan 08 23:20:36 2011 +0000 @@ -79,7 +79,8 @@ handler.connect = function (_, ...) return sock:connect(...) end --handler.send = function (_, data) _:write(data); return _.sendbuffer and _.sendbuffer(); end handler.send = function (_, data) - log("debug", "Sending DNS query to %s", sock:getpeername()); + local getpeername = sock.getpeername; + log("debug", "Sending DNS query to %s", (getpeername and getpeername(sock)) or "<unconnected>"); return sock:send(data); end return handler;