From c880668419867ff52d3e677aa7accb192c894da7 Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Tue, 30 Jul 2019 19:11:21 +0800 Subject: [PATCH] Register channel in this module --- src/emqx_channel.erl | 1 + src/emqx_ws_channel.erl | 1 + 2 files changed, 2 insertions(+) diff --git a/src/emqx_channel.erl b/src/emqx_channel.erl index 9c908c9bf..4cb5b3e17 100644 --- a/src/emqx_channel.erl +++ b/src/emqx_channel.erl @@ -255,6 +255,7 @@ connected(enter, _PrevSt, State = #state{proto_state = ProtoState}) -> NState = State#state{connected = true, connected_at = os:timestamp()}, ClientId = emqx_protocol:info(client_id, ProtoState), + ok = emqx_cm:register_channel(ClientId), ok = emqx_cm:set_chan_attrs(ClientId, attrs(NState)), %% Ensure keepalive after connected successfully. Interval = emqx_protocol:info(keepalive, ProtoState), diff --git a/src/emqx_ws_channel.erl b/src/emqx_ws_channel.erl index 1c21c29d8..09a6fb334 100644 --- a/src/emqx_ws_channel.erl +++ b/src/emqx_ws_channel.erl @@ -293,6 +293,7 @@ websocket_info({timeout, Timer, emit_stats}, proto_state = ProtoState, gc_state = GcState}) -> ClientId = emqx_protocol:info(client_id, ProtoState), + ok = emqx_cm:register_channel(ClientId), ok = emqx_cm:set_chan_stats(ClientId, stats(State)), NState = State#state{stats_timer = undefined}, Limits = erlang:get(force_shutdown_policy),