diff --git a/README.md b/README.md index 7e10c3a..58019e9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/resty/dns/client.lua b/src/resty/dns/client.lua index 57f6f71..99a6366 100644 --- a/src/resty/dns/client.lua +++ b/src/resty/dns/client.lua @@ -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 @@ -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)