Changeset

6507:84ca02c6a47e

net.adns: Log peername recorded from wrapped setpeername instead of calling sock:getpeername, it exists and throws an error on unconnected sockets (thanks wirehack7)
author Kim Alvefur <zash@zash.se>
date Thu, 30 Oct 2014 12:08:05 +0100
parents 6506:f869eec511c8
children 6508:4a28b8320d7f
files net/adns.lua
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/adns.lua	Thu Oct 30 12:05:24 2014 +0100
+++ b/net/adns.lua	Thu Oct 30 12:08:05 2014 +0100
@@ -80,8 +80,7 @@
 	handler.connect = function (_, ...) return sock:connect(...) end
 	--handler.send = function (_, data) _:write(data);  return _.sendbuffer and _.sendbuffer(); end
 	handler.send = function (_, data)
-		local getpeername = sock.getpeername;
-		log("debug", "Sending DNS query to %s", (getpeername and getpeername(sock)) or "<unconnected>");
+		log("debug", "Sending DNS query to %s", peername);
 		return sock:send(data);
 	end
 	return handler;