From 7b339efd6373e26037c83d93ef750eb46c7b23f4 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 30 Oct 2014 12:08:05 +0100 Subject: net.adns: Log peername recorded from wrapped setpeername instead of calling sock:getpeername, it exists and throws an error on unconnected sockets (thanks wirehack7) --- net/adns.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'net/adns.lua') diff --git a/net/adns.lua b/net/adns.lua index da7981ba..3fc958f4 100644 --- a/net/adns.lua +++ b/net/adns.lua @@ -80,8 +80,7 @@ function new_async_socket(sock, resolver) 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 ""); + log("debug", "Sending DNS query to %s", peername); return sock:send(data); end return handler; -- cgit v1.2.3