summaryrefslogtreecommitdiff
path: root/deps/rabbitmq_amqp1_0/src/rabbit_amqp1_0.erl
diff options
context:
space:
mode:
Diffstat (limited to 'deps/rabbitmq_amqp1_0/src/rabbit_amqp1_0.erl')
-rw-r--r--deps/rabbitmq_amqp1_0/src/rabbit_amqp1_0.erl40
1 files changed, 40 insertions, 0 deletions
diff --git a/deps/rabbitmq_amqp1_0/src/rabbit_amqp1_0.erl b/deps/rabbitmq_amqp1_0/src/rabbit_amqp1_0.erl
new file mode 100644
index 0000000000..c130e1a33f
--- /dev/null
+++ b/deps/rabbitmq_amqp1_0/src/rabbit_amqp1_0.erl
@@ -0,0 +1,40 @@
+%% This Source Code Form is subject to the terms of the Mozilla Public
+%% License, v. 2.0. If a copy of the MPL was not distributed with this
+%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
+%%
+%% Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved.
+%%
+-module(rabbit_amqp1_0).
+
+-export([connection_info_local/1,
+ emit_connection_info_local/3,
+ emit_connection_info_all/4,
+ list/0]).
+
+emit_connection_info_all(Nodes, Items, Ref, AggregatorPid) ->
+ Pids = [spawn_link(Node, rabbit_amqp1_0, emit_connection_info_local,
+ [Items, Ref, AggregatorPid])
+ || Node <- Nodes],
+ rabbit_control_misc:await_emitters_termination(Pids),
+ ok.
+
+emit_connection_info_local(Items, Ref, AggregatorPid) ->
+ rabbit_control_misc:emitting_map_with_exit_handler(
+ AggregatorPid, Ref,
+ fun(Pid) ->
+ rabbit_amqp1_0_reader:info(Pid, Items)
+ end,
+ list()).
+
+connection_info_local(Items) ->
+ Connections = list(),
+ [rabbit_amqp1_0_reader:info(Pid, Items) || Pid <- Connections].
+
+list() ->
+ [ReaderPid
+ || {_, TcpPid, _, [tcp_listener_sup]} <- supervisor:which_children(rabbit_sup),
+ {_, RanchLPid, _, [ranch_listener_sup]} <- supervisor:which_children(TcpPid),
+ {_, RanchCPid, _, [ranch_conns_sup]} <- supervisor:which_children(RanchLPid),
+ {rabbit_connection_sup, ConnPid, _, _} <- supervisor:which_children(RanchCPid),
+ {reader, ReaderPid, _, _} <- supervisor:which_children(ConnPid)
+ ].