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 76223ab commit 8f66a2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ History

Versioning is strictly based on [Semantic Versioning](https://semver.org/)

### 4.1.x (xxxx) unreleased

- Fix: added logging of try-list to the TCP/UDP wrappers, see [PR 75](https://github.com/Kong/lua-resty-dns-client/pull/75).

### 4.1.0 (7-Aug-2019)

- Fix: unhealthy balancers would not recover because they would not refresh the
Expand Down
10 changes: 5 additions & 5 deletions src/resty/dns/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1465,10 +1465,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 @@ -1488,13 +1488,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 8f66a2e

Please sign in to comment.