Update emqx_ws_connection for clientinfo

This commit is contained in:
terry-xiaoyu 2019-11-01 21:36:30 +08:00
parent b17a54d392
commit df3d7b628b
1 changed files with 3 additions and 3 deletions

View File

@ -350,14 +350,14 @@ handle_call(From, Req, State = #state{channel = Channel}) ->
%% Handle Info
handle_info({connack, ConnAck}, State = #state{channel = Channel}) ->
ClientId = emqx_channel:info(clientid, Channel),
#{clientid := ClientId} = emqx_channel:info(clientinfo, Channel),
ok = emqx_cm:register_channel(ClientId),
ok = emqx_cm:set_chan_attrs(ClientId, attrs(State)),
ok = emqx_cm:set_chan_stats(ClientId, stats(State)),
reply(enqueue(ConnAck, State));
handle_info({enter, disconnected}, State = #state{channel = Channel}) ->
ClientId = emqx_channel:info(clientid, Channel),
#{clientid := ClientId} = emqx_channel:info(clientinfo, Channel),
emqx_cm:set_chan_attrs(ClientId, attrs(State)),
emqx_cm:set_chan_stats(ClientId, stats(State)),
reply(State);
@ -378,7 +378,7 @@ handle_timeout(TRef, keepalive, State) when is_reference(TRef) ->
handle_timeout(TRef, emit_stats, State = #state{channel = Channel,
stats_timer = TRef}) ->
ClientId = emqx_channel:info(clientid, Channel),
#{clientid := ClientId} = emqx_channel:info(clientinfo, Channel),
(ClientId =/= undefined) andalso emqx_cm:set_chan_stats(ClientId, stats(State)),
reply(State#state{stats_timer = undefined});