summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2011-08-10 18:08:10 +0100
committerSimon MacMullen <simon@rabbitmq.com>2011-08-10 18:08:10 +0100
commit5c27f4d3c848fa8132e202733a05a53c4d3ae7b0 (patch)
treeacccc4522dac978b9bc5c76a80ffd7bd28ac8213 /src
parentbe0cc69ae9bc07b7a9ad2a60757c60c1c987a4d5 (diff)
parent96c02054ddc0b3ba02a9a7b27692a6f58465af67 (diff)
downloadrabbitmq-server-git-5c27f4d3c848fa8132e202733a05a53c4d3ae7b0.tar.gz
Merge heads
Diffstat (limited to 'src')
-rw-r--r--src/mirrored_supervisor.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mirrored_supervisor.erl b/src/mirrored_supervisor.erl
index 95183d1b53..0510573f2c 100644
--- a/src/mirrored_supervisor.erl
+++ b/src/mirrored_supervisor.erl
@@ -442,10 +442,17 @@ start(Delegate, ChildSpec) ->
apply(?SUPERVISOR, start_child, [Delegate, ChildSpec]).
stop(Delegate, Id) ->
+ case mnesia:transaction(fun() -> check_stop(Delegate, Id) end) of
+ {atomic, deleted} -> apply(?SUPERVISOR, delete_child, [Delegate, Id]);
+ {atomic, running} -> {error, running};
+ {aborted, E} -> {error, E}
+ end.
+
+check_stop(Delegate, Id) ->
case child(Delegate, Id) of
- undefined -> {atomic, ok} = mnesia:transaction(fun() -> delete(Id) end),
- apply(?SUPERVISOR, delete_child, [Delegate, Id]);
- _ -> {error, running}
+ undefined -> delete(Id),
+ deleted;
+ _ -> running
end.
id({Id, _, _, _, _, _}) -> Id.