Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
fix(logging) TCP/UDP wrappers now also report try_list
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Aug 20, 2019
1 parent 08cbd1e commit 272def8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/resty/dns/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1456,10 +1456,10 @@ end
-- @param opts the options table
-- @return `success`, or `nil + error`
local function connect(sock, host, port, sock_opts)
local targetIp, targetPort = toip(host, port)
local targetIp, targetPort, tryList = toip(host, port)

if not targetIp then
return nil, targetPort
return nil, tostring(targetPort) .. ". Tried: " .. tostring(tryList)
else
-- need to do the extra check here: https://github.com/openresty/lua-nginx-module/issues/860
if not sock_opts then
Expand All @@ -1479,13 +1479,13 @@ end
-- @param port port to connect to (will be overridden if `toip` returns a port)
-- @return `success`, or `nil + error`
local function setpeername(sock, host, port)
local targetIp, targetPort
local targetIp, targetPort, tryList
if host:sub(1,5) == "unix:" then
targetIp = host -- unix domain socket, nothing to resolve
else
targetIp, targetPort = toip(host, port)
targetIp, targetPort, tryList = toip(host, port)
if not targetIp then
return nil, targetPort
return nil, tostring(targetPort) .. ". Tried: " .. tostring(tryList)
end
end
return sock:connect(targetIp, targetPort)
Expand Down

0 comments on commit 272def8

Please sign in to comment.