diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2011-04-01 13:19:31 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2011-04-01 13:19:31 +0100 |
commit | 493f98d8b6fe5d85223e754b1c05b73903490857 (patch) | |
tree | 3a7ba86bb5eaac5c5690bf1d9675b4f155980e92 | |
parent | e12c48c0a75969d873fd761d8f8672d5bf32517d (diff) | |
download | rabbitmq-server-493f98d8b6fe5d85223e754b1c05b73903490857.tar.gz |
'shutdown' is only treated specially if the child is a supervisor (previous behaviour was actually confused on this front). Some minor renaming, reordering, and inliningbug23628
-rw-r--r-- | src/supervisor2.erl | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl index 19a95328..ec1ee9cd 100644 --- a/src/supervisor2.erl +++ b/src/supervisor2.erl @@ -38,7 +38,7 @@ %% child is a supervisor and it exits normally (i.e. with reason of %% 'shutdown') then the child's parent also exits normally. %% -%% 5) normal, shutdown and {shutdown, _} exit reasons are all treated the same +%% 5) normal, and {shutdown, _} exit reasons are all treated the same %% (i.e. are regarded as normal exits) %% %% All modifications are (C) 2010-2011 VMware, Inc. @@ -548,11 +548,11 @@ do_restart(permanent, Reason, Child, State) -> report_error(child_terminated, Reason, Child, State#state.name), restart(Child, State); do_restart(Type, normal, Child, State) -> - normal_or_shutdown_restart(Type, Child, State); -do_restart(Type, shutdown, Child, State) -> - normal_or_shutdown_restart(Type, Child, State); + del_child_and_maybe_shutdown(Type, Child, State); do_restart(Type, {shutdown, _}, Child, State) -> - normal_or_shutdown_restart(Type, Child, State); + del_child_and_maybe_shutdown(Type, Child, State); +do_restart(Type, shutdown, Child = #child{child_type = supervisor}, State) -> + del_child_and_maybe_shutdown(Type, Child, State); do_restart(Type, Reason, Child, State) when Type =:= transient orelse Type =:= intrinsic -> report_error(child_terminated, Reason, Child, State#state.name), @@ -562,11 +562,10 @@ do_restart(temporary, Reason, Child, State) -> NState = state_del_child(Child, State), {ok, NState}. -normal_or_shutdown_restart(intrinsic, Child, State) -> +del_child_and_maybe_shutdown(intrinsic, Child, State) -> {shutdown, state_del_child(Child, State)}; -normal_or_shutdown_restart(_, Child, State) -> - NState = state_del_child(Child, State), - {ok, NState}. +del_child_and_maybe_shutdown(_, Child, State) -> + {ok, state_del_child(Child, State)}. restart(Child, State) -> case add_restart(State) of |