Skip to content

Commit

Permalink
Use rabbit_networking new fun to list connections
Browse files Browse the repository at this point in the history
Discussion #9302
  • Loading branch information
LoisSotoLopez committed Mar 11, 2024
1 parent d8fd771 commit 81db97f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions deps/rabbitmq_web_mqtt/src/rabbit_web_mqtt_app.erl
Expand Up @@ -50,8 +50,8 @@ init([]) -> {ok, {{one_for_one, 1, 5}, []}}.

-spec list_connections() -> [pid()].
list_connections() ->
PlainPids = connection_pids_of_protocol(?TCP_PROTOCOL),
TLSPids = connection_pids_of_protocol(?TLS_PROTOCOL),
PlainPids = rabbit_networking:list_local_connections_of_protocol(?TCP_PROTOCOL),
TLSPids = rabbit_networking:list_local_connections_of_protocol(?TLS_PROTOCOL),
PlainPids ++ TLSPids.

-spec emit_connection_info_all([node()], rabbit_types:info_keys(), reference(), pid()) -> term().
Expand All @@ -77,12 +77,6 @@ emit_connection_info(Items, Ref, AggregatorPid, Pids) ->
%% Implementation
%%

connection_pids_of_protocol(Protocol) ->
case rabbit_networking:ranch_ref_of_protocol(Protocol) of
undefined -> [];
AcceptorRef -> ranch:procs(AcceptorRef, connections)
end.

mqtt_init() ->
CowboyOpts0 = maps:from_list(get_env(cowboy_opts, [])),
CowboyWsOpts = maps:from_list(get_env(cowboy_ws_opts, [])),
Expand Down

0 comments on commit 81db97f

Please sign in to comment.