From 9240a0355a113c01e8ced71977cbd168c411873b Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Wed, 29 Mar 2017 16:36:17 +0800 Subject: [PATCH] Fix issue #963 - shutdown if session process exited --- src/emqttd_ws_client.erl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/emqttd_ws_client.erl b/src/emqttd_ws_client.erl index 4beb7bc40..8797088e0 100644 --- a/src/emqttd_ws_client.erl +++ b/src/emqttd_ws_client.erl @@ -225,6 +225,14 @@ handle_info({'EXIT', WsPid, Reason}, State = #wsclient_state{ws_pid = WsPid}) -> ?WSLOG(error, "shutdown: ~p",[Reason], State), shutdown(Reason, State); +%% The session process exited unexpectedly. +handle_info({'EXIT', Pid, Reason}, State = #wsclient_state{proto_state = ProtoState}) -> + case emqttd_protocol:session(ProtoState) of + Pid -> shutdown(Reason, State); + _ -> ?WSLOG(error, "Unexpected EXIT: ~p, Reason: ~p", [Pid, Reason], State), + {noreply, State, hibernate} + end; + handle_info(Info, State) -> ?WSLOG(error, "Unexpected Info: ~p", [Info], State), {noreply, State, hibernate}.