diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2011-08-08 12:17:04 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2011-08-08 12:17:04 +0100 |
| commit | 62f6bda562541f078c3f8b7bdbf1001ceec3efc8 (patch) | |
| tree | 61135478b4b93f8169bbbe6aa5415361bc03f1cb /src | |
| parent | 26610eabd92603ede622a7ed4e0dab6f575ba10b (diff) | |
| download | rabbitmq-server-git-62f6bda562541f078c3f8b7bdbf1001ceec3efc8.tar.gz | |
Rename and refactor append_rpc_all_nodes, and get the networking:connections() to use it since otherwise it doesn't handle failures.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_channel.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_misc.erl | 15 | ||||
| -rw-r--r-- | src/rabbit_networking.erl | 10 |
3 files changed, 17 insertions, 10 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index f887afec5c..f875807ccd 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -133,7 +133,7 @@ confirm(Pid, MsgSeqNos) -> gen_server2:cast(Pid, {confirm, MsgSeqNos, self()}). list() -> - rabbit_misc:rpc_list_all_nodes(rabbit_channel, list_local, []). + rabbit_misc:append_rpc_all_nodes(rabbit_channel, list_local, []). list_local() -> pg_local:get_members(rabbit_channels). diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index fa1eea66a1..c196b685af 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -58,7 +58,7 @@ -export([is_process_alive/1]). -export([pget/2, pget/3, pget_or_die/2]). -export([format_message_queue/2]). --export([rpc_list_all_nodes/3]). +-export([append_rpc_all_nodes/3]). %%---------------------------------------------------------------------------- @@ -209,7 +209,7 @@ -spec(pget/3 :: (term(), [term()], term()) -> term()). -spec(pget_or_die/2 :: (term(), [term()]) -> term() | no_return()). -spec(format_message_queue/2 :: (any(), priority_queue:q()) -> term()). --spec(rpc_list_all_nodes/3 :: (atom(), atom(), [any()]) -> [any()]). +-spec(append_rpc_all_nodes/3 :: (atom(), atom(), [any()]) -> [any()]). -endif. @@ -957,8 +957,9 @@ format_message_queue_entry(V) when is_tuple(V) -> format_message_queue_entry(_V) -> '_'. -rpc_list_all_nodes(M, F, A) -> - [Res || Node <- [node() | nodes()], Res <- case rpc:call(Node, M, F, A) of - {badrpc, _} -> []; - R -> R - end]. +append_rpc_all_nodes(M, F, A) -> + {ResL, _} = rpc:multicall(M, F, A), + lists:append([case Res of + {badrpc, _} -> []; + _ -> Res + end || Res <- ResL]). diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl index a463649791..79dd084745 100644 --- a/src/rabbit_networking.erl +++ b/src/rabbit_networking.erl @@ -30,6 +30,9 @@ -export([tcp_listener_started/3, tcp_listener_stopped/3, start_client/1, start_ssl_client/2]). +%% Internal +-export([connections_local/0]). + -include("rabbit.hrl"). -include_lib("kernel/include/inet.hrl"). @@ -59,6 +62,7 @@ -spec(active_listeners/0 :: () -> [rabbit_types:listener()]). -spec(node_listeners/1 :: (node()) -> [rabbit_types:listener()]). -spec(connections/0 :: () -> [rabbit_types:connection()]). +-spec(connections_local/0 :: () -> [rabbit_types:connection()]). -spec(connection_info_keys/0 :: () -> rabbit_types:info_keys()). -spec(connection_info/1 :: (rabbit_types:connection()) -> rabbit_types:infos()). @@ -272,10 +276,12 @@ start_ssl_client(SslOpts, Sock) -> start_client(Sock, ssl_transform_fun(SslOpts)). connections() -> + rabbit_misc:append_rpc_all_nodes(rabbit_networking, connections_local, []). + +connections_local() -> [rabbit_connection_sup:reader(ConnSup) || - Node <- rabbit_mnesia:running_clustered_nodes(), {_, ConnSup, supervisor, _} - <- supervisor:which_children({rabbit_tcp_client_sup, Node})]. + <- supervisor:which_children(rabbit_tcp_client_sup)]. connection_info_keys() -> rabbit_reader:info_keys(). |
