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

fix(logging) TCP/UDP wrappers now also report try_list #75

Merged
merged 1 commit into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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