diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2011-02-07 11:10:37 +0000 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2011-02-07 11:10:37 +0000 |
commit | 6d2c0df52eb7be228a1fd289c71b8e665a73470e (patch) | |
tree | c26416aea535f36c9ac24affbb2e5957f466c640 | |
parent | d284a89b019cb283df2b06a1bf3040b7307327bf (diff) | |
download | rabbitmq-server-6d2c0df52eb7be228a1fd289c71b8e665a73470e.tar.gz |
Refactoring, cosmetics, consistency, return codes
-rw-r--r-- | src/rabbit.erl | 2 | ||||
-rw-r--r-- | src/rabbit_node_monitor.erl | 23 |
2 files changed, 11 insertions, 14 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index db4ae624..67e2e40f 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -230,7 +230,7 @@ start(normal, []) -> case erts_version_check() of ok -> {ok, SupPid} = rabbit_sup:start_link(), - register(rabbit, self()), + true = register(rabbit, self()), print_banner(), [ok = run_boot_step(Step) || Step <- boot_steps()], diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index 2c1e4b16..0f573309 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -45,19 +45,16 @@ rabbit_running_on(Node) -> gen_server:cast(rabbit_node_monitor, {rabbit_running_on, Node}). notify_cluster() -> + Node = node(), + Nodes = rabbit_mnesia:running_clustered_nodes() -- [Node], %% notify other rabbits of this rabbit - {_, BadNodes} = - rpc:multicall(rabbit_mnesia:running_clustered_nodes() -- [node()], - rabbit_node_monitor, rabbit_running_on, [node()], - ?RABBIT_UP_RPC_TIMEOUT), - case BadNodes of - [] -> ok; - _ -> rabbit_log:info("failed to contact nodes ~p", [BadNodes]) + case rpc:multicall(Nodes, rabbit_node_monitor, rabbit_running_on, + [Node], ?RABBIT_UP_RPC_TIMEOUT) of + {_, [] } -> ok; + {_, Bad} -> rabbit_log:info("failed to contact nodes ~p~n", [Bad]) end, %% register other active rabbits with this rabbit - [ rabbit_node_monitor:rabbit_running_on(Node) - || Node <- rabbit_mnesia:running_clustered_nodes(), - Node =/= node() ], + [ rabbit_node_monitor:rabbit_running_on(N) || N <- Nodes ], ok. %%-------------------------------------------------------------------- @@ -70,18 +67,18 @@ handle_call(_Request, _From, State) -> {noreply, State}. handle_cast({rabbit_running_on, Node}, State) -> - rabbit_log:info("node ~p up", [Node]), + rabbit_log:info("node ~p up~n", [Node]), erlang:monitor(process, {rabbit, Node}), {noreply, State}; handle_cast(_Msg, State) -> {noreply, State}. handle_info({nodedown, Node}, State) -> - rabbit_log:info("node ~p down", [Node]), + rabbit_log:info("node ~p down~n", [Node]), ok = handle_dead_rabbit(Node, true), {noreply, State}; handle_info({'DOWN', _MRef, process, {rabbit, Node}, _Reason}, State) -> - rabbit_log:info("node ~p lost 'rabbit'", [Node]), + rabbit_log:info("node ~p lost 'rabbit'~n", [Node]), ok = handle_dead_rabbit(Node, false), {noreply, State}; handle_info(_Info, State) -> |