summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-10-16 15:14:07 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2012-10-16 15:14:07 +0100
commit1e44da5f708f5c1be16adcb1398f123516a864d5 (patch)
tree634e93b21af6029b1d2e40825da7dcd9a1eeb97b
parent77c08d8f1407aff5055423e0a7049b276fbc4a5b (diff)
downloadrabbitmq-server-git-1e44da5f708f5c1be16adcb1398f123516a864d5.tar.gz
compare pids instead of nodes in slave's handle_call/gm_deaths
-rw-r--r--src/rabbit_mirror_queue_slave.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl
index a26708af5b..807e6310fc 100644
--- a/src/rabbit_mirror_queue_slave.erl
+++ b/src/rabbit_mirror_queue_slave.erl
@@ -179,18 +179,20 @@ handle_call({gm_deaths, Deaths}, From,
gen_server2:reply(From, ok),
{stop, normal, State};
{ok, Pid, DeadPids} ->
- rabbit_mirror_queue_misc:report_deaths(self(), false, QName,
+ Self = self(),
+ rabbit_mirror_queue_misc:report_deaths(Self, false, QName,
DeadPids),
- if node(Pid) =:= node(MPid) ->
+ case Pid of
+ MPid ->
%% master hasn't changed
gen_server2:reply(From, ok),
noreply(State);
- node(Pid) =:= node() ->
+ Self ->
%% we've become master
QueueState = promote_me(From, State),
{become, rabbit_amqqueue_process, QueueState, hibernate};
- true ->
- %% master has changed to not us.
+ _ ->
+ %% master has changed to not us
gen_server2:reply(From, ok),
erlang:monitor(process, Pid),
noreply(State #state { q = Q #amqqueue { pid = Pid } })