summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2011-11-01 18:28:51 +0000
committerEmile Joubert <emile@rabbitmq.com>2011-11-01 18:28:51 +0000
commit90e503913273ac1ee2ae61994313eb9da1555e34 (patch)
treeba2b8c57fa900c533088e3388dbb7b3f63ac37a7
parent4810062a5f72d1c83118377178ea7229169aad30 (diff)
downloadrabbitmq-server-90e503913273ac1ee2ae61994313eb9da1555e34.tar.gz
Refactor supervisor shutdown more
-rw-r--r--src/supervisor2.erl17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl
index 1f758405..3b66d4b8 100644
--- a/src/supervisor2.erl
+++ b/src/supervisor2.erl
@@ -671,13 +671,10 @@ terminate_simple_children(Child, Dynamics, SupName) ->
receive {'DOWN', _, process, Pid, Reason} ->
{dict:append(Pid, {error, Reason}, Replies), true}
end;
- {'DOWN', _MRef, process, Pid, Reason}
- when Child#child.shutdown == brutal_kill andalso
- Reason == killed andalso Timedout == false orelse
- Reason == shutdown andalso Timedout == false ->
- {dict:append(Pid, ok, Replies), Timedout};
{'DOWN', _MRef, process, Pid, Reason} ->
- {dict:append(Pid, {error, Reason}, Replies), Timedout};
+ {dict:append(Pid, child_tally(Child#child.shutdown,
+ Reason, Timedout),
+ Replies), Timedout};
{'EXIT', Pid, Reason} ->
receive {'DOWN', _MRef, process, Pid, _} ->
{dict:append(Pid, {error, Reason}, Replies), Timedout}
@@ -707,9 +704,15 @@ terminate_simple_children(Child, Dynamics, SupName) ->
end, ok, Replies),
ok.
+child_tally(Shutdown, Reason, Timedout)
+ when Shutdown == brutal_kill andalso Reason == killed andalso
+ Timedout == false orelse Reason == shutdown andalso
+ Timedout == false -> ok;
+child_tally(_Shutdown, Reason, _Timedout) -> {error, Reason}.
+
restart_permanent(permanent) -> true;
restart_permanent({permanent, _Delay}) -> true;
-restart_permanent(_) -> false;
+restart_permanent(_) -> false.
do_terminate(Child, SupName) when Child#child.pid =/= undefined ->
ReportError = shutdown_error_reporter(SupName),