remove trap_exit flag, and fix issue #413
This commit is contained in:
parent
78dd1f8838
commit
2dd8c3d778
|
@ -123,7 +123,8 @@ reset_parser(State = #wsocket_state{packet_opts = PktOpts}) ->
|
||||||
%%%=============================================================================
|
%%%=============================================================================
|
||||||
|
|
||||||
init([WsPid, Req, ReplyChannel, PktOpts]) ->
|
init([WsPid, Req, ReplyChannel, PktOpts]) ->
|
||||||
process_flag(trap_exit, true),
|
%%issue#413: trap_exit is unnecessary
|
||||||
|
%%process_flag(trap_exit, true),
|
||||||
{ok, Peername} = Req:get(peername),
|
{ok, Peername} = Req:get(peername),
|
||||||
SendFun = fun(Payload) -> ReplyChannel({binary, Payload}) end,
|
SendFun = fun(Payload) -> ReplyChannel({binary, Payload}) end,
|
||||||
Headers = mochiweb_request:get(headers, Req),
|
Headers = mochiweb_request:get(headers, Req),
|
||||||
|
@ -220,18 +221,9 @@ handle_info({keepalive, check}, State = #wsclient_state{request = Req,
|
||||||
shutdown(keepalive_error, State)
|
shutdown(keepalive_error, State)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
handle_info({'EXIT', WsPid, Reason}, State = #wsclient_state{ws_pid = WsPid}) ->
|
%%issue#413: removed the trap_exit flag
|
||||||
stop(Reason, State);
|
%%handle_info({'EXIT', WsPid, Reason}, State = #wsclient_state{ws_pid = WsPid}) ->
|
||||||
|
%% stop(Reason, State);
|
||||||
handle_info({'EXIT', SessPid, Reason}, State = #wsclient_state{request = Req,
|
|
||||||
proto_state = ProtoState}) ->
|
|
||||||
case emqttd_protocol:session(ProtoState) of
|
|
||||||
SessPid ->
|
|
||||||
stop(Reason, State);
|
|
||||||
ExitPid ->
|
|
||||||
?WSLOG(error, "Unexpected EXIT ~p for ~p", [ExitPid, Reason], Req),
|
|
||||||
noreply(State)
|
|
||||||
end;
|
|
||||||
|
|
||||||
handle_info(Info, State = #wsclient_state{request = Req}) ->
|
handle_info(Info, State = #wsclient_state{request = Req}) ->
|
||||||
?WSLOG(critical, "Unexpected Info: ~p", [Info], Req),
|
?WSLOG(critical, "Unexpected Info: ~p", [Info], Req),
|
||||||
|
|
Loading…
Reference in New Issue