From 430f20adc116763a23844e2786e55d85f3c339b4 Mon Sep 17 00:00:00 2001 From: JianBo He Date: Tue, 17 Aug 2021 14:17:56 +0800 Subject: [PATCH] fix(gw): fix conn_state --- apps/emqx_gateway/src/emqx_gateway_cli.erl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/emqx_gateway/src/emqx_gateway_cli.erl b/apps/emqx_gateway/src/emqx_gateway_cli.erl index 2430b38e6..b446cda92 100644 --- a/apps/emqx_gateway/src/emqx_gateway_cli.erl +++ b/apps/emqx_gateway/src/emqx_gateway_cli.erl @@ -107,7 +107,12 @@ gateway(_) -> 'gateway-clients'(["list", Name]) -> InfoTab = emqx_gateway_cm:tabname(info, Name), - dump(InfoTab, client); + case ets:info(InfoTab) of + undefined -> + emqx_ctl:print("Bad Gateway Name.~n"); + _ -> + dump(InfoTab, client) + end; 'gateway-clients'(["lookup", Name, ClientId]) -> ChanTab = emqx_gateway_cm:tabname(chan, Name), @@ -191,7 +196,7 @@ print({client, {_, Infos, Stats}}) -> keepalive => SafeGet(keepalive, ConnInfo), subscriptions_cnt => StatsGet(subscriptions_cnt), send_msg => StatsGet(send_msg), - connected => SafeGet(conn_state, ClientInfo) == connected, + connected => SafeGet(conn_state, Infos) == connected, created_at => ConnectedAt, connected_at => ConnectedAt },