Software /
code /
prosody
Changeset
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 |
parents | 4102:9df4e61c260b |
children | 4104:582ba9c459ad 4105:08560575762f |
files | net/adns.lua |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
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;