Skip to content
Open
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
9 changes: 3 additions & 6 deletions lib/resty/logger/socket.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,11 @@ local function _do_connect()
end

-- "host"/"port" and "path" have already been checked in init()
local connector = sock_type == 'udp' and sock.setpeername or sock.connect
if host and port then
if (sock_type == 'udp') then
ok, err = sock:setpeername(host, port)
else
ok, err = sock:connect(host, port)
end
ok, err = connector(sock, host, port)
elseif path then
ok, err = sock:connect("unix:" .. path)
ok, err = connector(sock, "unix:" .. path)
end

if not ok then
Expand Down