Skip to content

Commit

Permalink
Extend error reason in case of failed handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
Maria-12648430 committed May 7, 2024
1 parent a8f31f3 commit c50a115
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/ranch.erl
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,13 @@ handshake_result(Result, Ref, Transport, CSocket, Timeout) ->
{ok, CSocket2, Info} ->
self() ! {handshake_continue, Ref, Transport, CSocket2, Timeout},
{continue, Info};
{error, {tls_alert, _}} ->
ok = Transport:close(CSocket),
exit(normal);
{error, Reason} when Reason =:= timeout; Reason =:= closed ->
ok = Transport:close(CSocket),
exit(normal);
{error, Reason} ->
PeerInfo = case Transport:peername(CSocket) of
{ok, Peer} -> Peer;
{error, _} -> undefined
end,
ok = Transport:close(CSocket),
error(Reason)
exit({shutdown, {Reason, PeerInfo}})
end.

-spec handshake_cancel(ref()) -> ok.
Expand Down

0 comments on commit c50a115

Please sign in to comment.