Fix websocket bug.

Prior to this change, websocket connection would be closed directly
without sending connack packet when acl check fails.

This change fix this bug.
This commit is contained in:
GilbertWong 2019-06-12 14:50:29 +08:00 committed by turtleDeng
parent 76525cc703
commit e73c4c64d0
1 changed files with 2 additions and 2 deletions

View File

@ -301,7 +301,6 @@ websocket_info(Info, State) ->
terminate(SockError, _Req, #state{keepalive = Keepalive, terminate(SockError, _Req, #state{keepalive = Keepalive,
proto_state = ProtoState, proto_state = ProtoState,
shutdown = Shutdown}) -> shutdown = Shutdown}) ->
?LOG(debug, "[WS Connection] Terminated for ~p, sockerror: ~p", [Shutdown, SockError]), ?LOG(debug, "[WS Connection] Terminated for ~p, sockerror: ~p", [Shutdown, SockError]),
emqx_keepalive:cancel(Keepalive), emqx_keepalive:cancel(Keepalive),
case {ProtoState, Shutdown} of case {ProtoState, Shutdown} of
@ -327,7 +326,8 @@ ensure_stats_timer(State) ->
State. State.
shutdown(Reason, State) -> shutdown(Reason, State) ->
{stop, State#state{shutdown = Reason}}. self() ! {stop, State#state{shutdown = Reason}},
{ok, State}.
wsock_stats() -> wsock_stats() ->
[{Key, emqx_pd:get_counter(Key)} || Key <- ?SOCK_STATS]. [{Key, emqx_pd:get_counter(Key)} || Key <- ?SOCK_STATS].