diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2011-12-01 18:28:26 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2011-12-01 18:28:26 +0000 |
| commit | a1c79a7dd1c3d6392ff363bfe46cd322eb157bd2 (patch) | |
| tree | d1277ab2ab0912cbe4ad25ee8236b73e24ee2277 /src | |
| parent | eb00309010121d9c443c9852c17edf5041f7bbbe (diff) | |
| download | rabbitmq-server-git-a1c79a7dd1c3d6392ff363bfe46cd322eb157bd2.tar.gz | |
We need to distinguish between the already_started we make get back from the real supervisor (which we need to treat as a real error at init) and the one we cons up ourselves (which we can ignore at init since in general all the mirrored sups in a group will have the same childspecs). But we treat them both as errors for start_child though.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mirrored_supervisor.erl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mirrored_supervisor.erl b/src/mirrored_supervisor.erl index e5ea648d10..02a2f37890 100644 --- a/src/mirrored_supervisor.erl +++ b/src/mirrored_supervisor.erl @@ -357,7 +357,11 @@ handle_call({init, Overall}, _From, handle_call({start_child, ChildSpec}, _From, State = #state{delegate = Delegate, group = Group}) -> - {reply, maybe_start(Group, Delegate, ChildSpec), State}; + {reply, case maybe_start(Group, Delegate, ChildSpec) of + already_in_mnesia -> {error, already_present}; + {already_in_mnesia, Pid} -> {error, {already_started, Pid}}; + Else -> Else + end, State}; handle_call({delete_child, Id}, _From, State = #state{delegate = Delegate, group = Group}) -> @@ -436,8 +440,8 @@ maybe_start(Group, Delegate, ChildSpec) -> check_start(Group, Delegate, ChildSpec) end) of {atomic, start} -> start(Delegate, ChildSpec); - {atomic, undefined} -> {error, already_present}; - {atomic, Pid} -> {error, {already_started, Pid}}; + {atomic, undefined} -> already_in_mnesia; + {atomic, Pid} -> {already_in_mnesia, Pid}; %% If we are torn down while in the transaction... {aborted, E} -> {error, E} end. |
