Skip to content

Commit

Permalink
close socket on failed handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Jan 27, 2024
1 parent b64082b commit 9e27b6e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/ch/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ defmodule Ch.Connection do
{:ok, conn}

result ->
{:error,
Error.exception("unexpected result for '#{handshake}': " <> inspect(result))}
{:ok, _conn} = HTTP.close(conn)
reason = Error.exception("unexpected result for '#{handshake}': #{inspect(result)}")
{:error, reason}
end

{:error, reason, _conn} ->
{:error, reason, conn} ->
{:ok, _conn} = HTTP.close(conn)
{:error, reason}

{:disconnect, reason, _conn} ->
{:disconnect, reason, conn} ->
{:ok, _conn} = HTTP.close(conn)
{:error, reason}
end
end
Expand Down

0 comments on commit 9e27b6e

Please sign in to comment.