Comparison

net/adns.lua @ 6506:f869eec511c8

net.adns: Preserve error from setpeername
author Kim Alvefur <zash@zash.se>
date Thu, 30 Oct 2014 12:05:24 +0100
parent 6287:a380b09649e6
child 6507:84ca02c6a47e
comparison
equal deleted inserted replaced
6500:c1b06cda8b0d 6506:f869eec511c8
74 return nil, err; 74 return nil, err;
75 end 75 end
76 76
77 handler.settimeout = function () end 77 handler.settimeout = function () end
78 handler.setsockname = function (_, ...) return sock:setsockname(...); end 78 handler.setsockname = function (_, ...) return sock:setsockname(...); end
79 handler.setpeername = function (_, ...) peername = (...); local ret = sock:setpeername(...); _:set_send(dummy_send); return ret; end 79 handler.setpeername = function (_, ...) peername = (...); local ret, err = sock:setpeername(...); _:set_send(dummy_send); return ret, err; end
80 handler.connect = function (_, ...) return sock:connect(...) end 80 handler.connect = function (_, ...) return sock:connect(...) end
81 --handler.send = function (_, data) _:write(data); return _.sendbuffer and _.sendbuffer(); end 81 --handler.send = function (_, data) _:write(data); return _.sendbuffer and _.sendbuffer(); end
82 handler.send = function (_, data) 82 handler.send = function (_, data)
83 local getpeername = sock.getpeername; 83 local getpeername = sock.getpeername;
84 log("debug", "Sending DNS query to %s", (getpeername and getpeername(sock)) or "<unconnected>"); 84 log("debug", "Sending DNS query to %s", (getpeername and getpeername(sock)) or "<unconnected>");