Skip to content

Commit

Permalink
close socket connection when websocket connect failed to avoid potent…
Browse files Browse the repository at this point in the history
…ial leak
  • Loading branch information
ProBrian committed Dec 19, 2024
1 parent f7f7a23 commit f472617
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions kong/clustering/rpc/manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ function _M:connect(premature, node_id, host, path, cert, key)
::err::

if not exiting() then
c:close()
self:try_connect(reconnection_delay)
end
end
Expand Down
1 change: 1 addition & 0 deletions kong/clustering/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function _M.connect_cp(dp, endpoint, protocols)

local ok, err = c:connect(uri, opts)
if not ok then
c:close()
return nil, uri, err
end

Expand Down

0 comments on commit f472617

Please sign in to comment.