diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2011-07-11 16:31:48 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2011-07-11 16:31:48 +0100 |
| commit | 1639445b0cb3a53944261b0dd0bf9d71b0ac1106 (patch) | |
| tree | ffc65835f58e5d42f52991a1f5d4ef85d9f98043 /src | |
| parent | ce75f3bc26eb0d52f1a83431bbc5c71cae51cd08 (diff) | |
| download | rabbitmq-server-git-1639445b0cb3a53944261b0dd0bf9d71b0ac1106.tar.gz | |
Fix race. Use cast. No "hello".
Diffstat (limited to 'src')
| -rw-r--r-- | src/mirrored_supervisor.erl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mirrored_supervisor.erl b/src/mirrored_supervisor.erl index 97a68e9608..1e84bf0a12 100644 --- a/src/mirrored_supervisor.erl +++ b/src/mirrored_supervisor.erl @@ -280,12 +280,12 @@ init({delegate, Restart}) -> init({mirroring, Group, ChildSpecs}) -> ?PG2:create(Group), + ok = ?PG2:join(Group, self()), [begin - gen_server2:call(Pid, {hello, self()}, infinity), + gen_server2:cast(Pid, {ensure_monitoring, self()}), erlang:monitor(process, Pid) end - || Pid <- ?PG2:get_members(Group)], - ok = ?PG2:join(Group, self()), + || Pid <- ?PG2:get_members(Group) -- [self()]], {ok, #state{group = Group, initial_childspecs = ChildSpecs}}. handle_call({finish_startup, Overall}, _From, @@ -306,16 +306,16 @@ handle_call({delete_child, Id}, _From, handle_call({msg, F, A}, _From, State = #state{overall = Overall}) -> {reply, apply(?SUPERVISOR, F, [child(Overall, delegate) | A]), State}; -handle_call({hello, Pid}, _From, State) -> - erlang:monitor(process, Pid), - {reply, ok, State}; - handle_call(overall_supervisor, _From, State = #state{overall = Overall}) -> {reply, Overall, State}; handle_call(Msg, _From, State) -> {stop, {unexpected_call, Msg}, State}. +handle_cast({ensure_monitoring, Pid}, State) -> + erlang:monitor(process, Pid), + {noreply, State}; + handle_cast(Msg, State) -> {stop, {unexpected_cast, Msg}, State}. |
