summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2011-08-17 15:37:46 +0100
committerSimon MacMullen <simon@rabbitmq.com>2011-08-17 15:37:46 +0100
commitc05d03cdea1d476d6f9b4d86a3655eaf40373764 (patch)
treeaa0bd112e982f556906a6ade3cb47fcf3bd2c528 /src
parent7cf68828f0e8d83d061218436e906ca831e11e26 (diff)
downloadrabbitmq-server-git-c05d03cdea1d476d6f9b4d86a3655eaf40373764.tar.gz
{error, already_present}
Diffstat (limited to 'src')
-rw-r--r--src/mirrored_supervisor.erl7
-rw-r--r--src/mirrored_supervisor_tests.erl4
2 files changed, 7 insertions, 4 deletions
diff --git a/src/mirrored_supervisor.erl b/src/mirrored_supervisor.erl
index e4d0983388..0d0b430c42 100644
--- a/src/mirrored_supervisor.erl
+++ b/src/mirrored_supervisor.erl
@@ -424,10 +424,11 @@ maybe_start(Group, Delegate, ChildSpec) ->
case mnesia:transaction(fun() ->
check_start(Group, Delegate, ChildSpec)
end) of
- {atomic, start} -> start(Delegate, ChildSpec);
- {atomic, Pid} -> {error, {already_started, Pid}};
+ {atomic, start} -> start(Delegate, ChildSpec);
+ {atomic, undefined} -> {error, already_present};
+ {atomic, Pid} -> {error, {already_started, Pid}};
%% If we are torn down while in the transaction...
- {aborted, E} -> {error, E}
+ {aborted, E} -> {error, E}
end.
check_start(Group, Delegate, ChildSpec) ->
diff --git a/src/mirrored_supervisor_tests.erl b/src/mirrored_supervisor_tests.erl
index aea9c05c53..bcec95c2f6 100644
--- a/src/mirrored_supervisor_tests.erl
+++ b/src/mirrored_supervisor_tests.erl
@@ -154,7 +154,9 @@ test_start_idempotence() ->
with_sups(fun([_]) ->
CS = childspec(worker),
{ok, Pid} = ?MS:start_child(a, CS),
- {error, {already_started, Pid}} = ?MS:start_child(a, CS)
+ {error, {already_started, Pid}} = ?MS:start_child(a, CS),
+ ?MS:terminate_child(a, worker),
+ {error, already_present} = ?MS:start_child(a, CS)
end, [a]).
test_unsupported() ->