From 98072dd3d13c2a959105d6a03e951a57a929b875 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Mon, 26 Aug 2019 16:43:08 +0800 Subject: [PATCH] Set stats at connection time --- src/emqx_connection.erl | 1 + src/emqx_ws_connection.erl | 1 + 2 files changed, 2 insertions(+) diff --git a/src/emqx_connection.erl b/src/emqx_connection.erl index 93daf4cba..99814d7af 100644 --- a/src/emqx_connection.erl +++ b/src/emqx_connection.erl @@ -245,6 +245,7 @@ connected(enter, _PrevSt, State = #state{chan_state = ChanState}) -> #{client_id := ClientId} = emqx_channel:info(client, ChanState), ok = emqx_cm:register_channel(ClientId), ok = emqx_cm:set_chan_attrs(ClientId, attrs(State)), + ok = emqx_cm:set_chan_stats(ClientId, stats(State)), keep_state_and_data; connected(cast, {incoming, Packet = ?PACKET(?CONNECT)}, State) -> diff --git a/src/emqx_ws_connection.erl b/src/emqx_ws_connection.erl index e28f74b06..4ec349769 100644 --- a/src/emqx_ws_connection.erl +++ b/src/emqx_ws_connection.erl @@ -330,6 +330,7 @@ connected(State = #state{chan_state = ChanState}) -> #{client_id := ClientId} = emqx_channel:info(client, ChanState), ok = emqx_cm:register_channel(ClientId), ok = emqx_cm:set_chan_attrs(ClientId, attrs(NState)), + ok = emqx_cm:set_chan_stats(ClientId, stats(NState)), reply(NState). %%--------------------------------------------------------------------