ws disconnect call emqx_protocol:shutdown

This commit is contained in:
turtled 2018-08-29 21:39:09 +08:00
parent d6f3ae640d
commit 98698d318f
1 changed files with 2 additions and 4 deletions

View File

@ -236,17 +236,15 @@ websocket_info(Info, State) ->
{ok, State}. {ok, State}.
terminate(SockError, _Req, #state{keepalive = Keepalive, terminate(SockError, _Req, #state{keepalive = Keepalive,
proto_state = _ProtoState, proto_state = ProtoState,
shutdown_reason = Reason}) -> shutdown_reason = Reason}) ->
emqx_keepalive:cancel(Keepalive), emqx_keepalive:cancel(Keepalive),
io:format("Websocket shutdown for ~p, sockerror: ~p~n", [Reason, SockError]), io:format("Websocket shutdown for ~p, sockerror: ~p~n", [Reason, SockError]),
case Reason of case Reason of
undefined -> undefined ->
ok; ok;
%%TODO:
%%emqx_protocol:shutdown(SockError, ProtoState);
_ -> _ ->
ok%%emqx_protocol:shutdown(Reason, ProtoState) emqx_protocol:shutdown(Reason, ProtoState)
end. end.
reset_parser(State = #state{proto_state = ProtoState}) -> reset_parser(State = #state{proto_state = ProtoState}) ->