fix: crash on emqx_ctl listeners

This commit is contained in:
zhongwencool 2023-06-19 18:12:33 +08:00
parent e818c0b528
commit 6efb07f6eb
1 changed files with 22 additions and 15 deletions

View File

@ -616,21 +616,28 @@ listeners([]) ->
Acceptors = maps:get(acceptors, Conf), Acceptors = maps:get(acceptors, Conf),
ProxyProtocol = maps:get(proxy_protocol, Conf, undefined), ProxyProtocol = maps:get(proxy_protocol, Conf, undefined),
Running = maps:get(running, Conf), Running = maps:get(running, Conf),
CurrentConns = case Running of
case emqx_listeners:current_conns(ID, Bind) of true ->
{error, _} -> []; CurrentConns =
CC -> [{current_conn, CC}] case emqx_listeners:current_conns(ID, Bind) of
end, {error, _} -> [];
MaxConn = CC -> [{current_conn, CC}]
case emqx_listeners:max_conns(ID, Bind) of end,
{error, _} -> []; MaxConn =
MC -> [{max_conns, MC}] case emqx_listeners:max_conns(ID, Bind) of
end, {error, _} -> [];
ShutdownCount = MC -> [{max_conns, MC}]
case emqx_listeners:shutdown_count(ID, Bind) of end,
{error, _} -> []; ShutdownCount =
SC -> [{shutdown_count, SC}] case emqx_listeners:shutdown_count(ID, Bind) of
end, {error, _} -> [];
SC -> [{shutdown_count, SC}]
end;
false ->
CurrentConns = [],
MaxConn = [],
ShutdownCount = []
end,
Info = Info =
[ [
{listen_on, {string, emqx_listeners:format_bind(Bind)}}, {listen_on, {string, emqx_listeners:format_bind(Bind)}},