summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-02-11 14:07:56 +0000
committerSimon MacMullen <simon@rabbitmq.com>2014-02-11 14:07:56 +0000
commit8df07d4a70d3e5c225df8d97d0f2ed5ffced1935 (patch)
tree5dc19b518388f3ffac52e88286492872305fcb6e
parent7c2cebd2dc3e41e74c887ead75577391e493aad8 (diff)
downloadrabbitmq-server-git-8df07d4a70d3e5c225df8d97d0f2ed5ffced1935.tar.gz
Handle down messages from the delegate, since that's what we're monitoring locally. And make sure that cast/2 has cast-like semantics - don't blow up if the gen_server has stopped.
-rw-r--r--src/mirrored_supervisor.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mirrored_supervisor.erl b/src/mirrored_supervisor.erl
index f44b1f1d7e..ae35526fed 100644
--- a/src/mirrored_supervisor.erl
+++ b/src/mirrored_supervisor.erl
@@ -245,7 +245,9 @@ count_children(Sup) -> fold(count_children, Sup, fun add_proplists/2).
check_childspecs(Specs) -> ?SUPERVISOR:check_childspecs(Specs).
call(Sup, Msg) -> ?GEN_SERVER:call(mirroring(Sup), Msg, infinity).
-cast(Sup, Msg) -> ?GEN_SERVER:cast(mirroring(Sup), Msg).
+cast(Sup, Msg) -> with_exit_handler(
+ fun() -> ok end,
+ fun() -> ?GEN_SERVER:cast(mirroring(Sup), Msg) end).
find_call(Sup, Id, Msg) ->
Group = call(Sup, group),
@@ -369,7 +371,7 @@ handle_cast(Msg, State) ->
{stop, {unexpected_cast, Msg}, State}.
handle_info({'DOWN', _Ref, process, Pid, Reason},
- State = #state{overall = Pid, group = Group}) ->
+ State = #state{delegate = Pid, group = Group}) ->
%% Since the delegate is temporary, its death won't cause us to
%% die. Since the overall supervisor kills processes in reverse
%% order when shutting down "from above" and we started after the