Merge pull request #2691 from emqx/master

Fix the websocket normal exit bug
This commit is contained in:
turtleDeng 2019-07-16 01:42:26 +08:00 committed by GitHub
commit 4d14d51dcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -315,9 +315,8 @@ terminate(SockError, _Req, #state{keepalive = Keepalive,
emqx_protocol:terminate(Reason, ProtoState), emqx_protocol:terminate(Reason, ProtoState),
exit(Reason); exit(Reason);
{_, Error} -> {_, Error} ->
?LOG(error, "Unexpected terminated for ~p", [Error]),
emqx_protocol:terminate(Error, ProtoState), emqx_protocol:terminate(Error, ProtoState),
exit(unknown) exit({error, SockError})
end. end.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
@ -346,7 +345,7 @@ ensure_stats_timer(State) ->
shutdown(Reason, State) -> shutdown(Reason, State) ->
%% Fix the issue#2591(https://github.com/emqx/emqx/issues/2591#issuecomment-500278696) %% Fix the issue#2591(https://github.com/emqx/emqx/issues/2591#issuecomment-500278696)
self() ! {stop, State#state{shutdown = {shutdown, Reason}}}, self() ! {stop, {shutdown, Reason}},
{ok, State}. {ok, State}.
wsock_stats() -> wsock_stats() ->