Skip to content
This repository was archived by the owner on Nov 18, 2020. It is now read-only.

Commit 76dfe1d

Browse files
author
Simon MacMullen
committed
Backport ccb6b7732d6a (Merge of bug24793; function_clause on SSL connection hard error)
1 parent 152024f commit 76dfe1d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/amqp_network_connection.erl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,17 @@ handle_message({socket_error, _} = SocketError, State) ->
6868
handle_message({channel_exit, Reason}, State) ->
6969
{stop, {channel0_died, Reason}, State};
7070
handle_message(heartbeat_timeout, State) ->
71-
{stop, heartbeat_timeout, State}.
71+
{stop, heartbeat_timeout, State};
72+
%% see http://erlang.org/pipermail/erlang-bugs/2012-June/002933.html
73+
handle_message({Ref, {error, Reason}},
74+
State = #state{waiting_socket_close = Waiting,
75+
closing_reason = CloseReason})
76+
when is_reference(Ref) ->
77+
{stop, case {Reason, Waiting} of
78+
{closed, true} -> {shutdown, CloseReason};
79+
{closed, false} -> socket_closed_unexpectedly;
80+
{_, _} -> {socket_error, Reason}
81+
end, State}.
7282

7383
closing(_ChannelCloseType, Reason, State) ->
7484
{ok, State#state{closing_reason = Reason}}.

0 commit comments

Comments
 (0)