summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-04-24 12:15:43 +0100
committerSimon MacMullen <simon@rabbitmq.com>2013-04-24 12:15:43 +0100
commit7f4b87411bc8e5d83a4a17740db76fbcb52eec54 (patch)
tree3c40def0dad584633f6da6e65350c801f96bc122
parent8fff2197fc071404825845135cc48a83ec239914 (diff)
downloadrabbitmq-server-7f4b87411bc8e5d83a4a17740db76fbcb52eec54.tar.gz
Add explanations to pmon:is_monitored/2 invocations.
-rw-r--r--src/rabbit_mirror_queue_slave.erl11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl
index 22edfcb6..63a53e2b 100644
--- a/src/rabbit_mirror_queue_slave.erl
+++ b/src/rabbit_mirror_queue_slave.erl
@@ -605,6 +605,10 @@ ensure_monitoring(ChPid, State = #state { known_senders = KS }) ->
State #state { known_senders = pmon:monitor(ChPid, KS) }.
local_sender_death(ChPid, State = #state { known_senders = KS }) ->
+ %% The channel will be monitored iff we have received a delivery
+ %% from it but not heard about its death from the master. So if it
+ %% is monitored we need to point the death out to the master (see
+ %% essay).
ok = case pmon:is_monitored(ChPid, KS) of
false -> ok;
true -> credit_flow:peer_down(ChPid),
@@ -621,6 +625,10 @@ confirm_sender_death(Pid) ->
fun (?MODULE, State = #state { known_senders = KS,
gm = GM }) ->
%% We're running still as a slave
+ %%
+ %% See comment in local_sender_death/2; we might have
+ %% received a sender_death in the meanwhile so check
+ %% again.
ok = case pmon:is_monitored(Pid, KS) of
false -> ok;
true -> gm:broadcast(GM, {ensure_monitoring, [Pid]}),
@@ -766,6 +774,9 @@ process_instruction({sender_death, ChPid},
State = #state { sender_queues = SQ,
msg_id_status = MS,
known_senders = KS }) ->
+ %% The channel will be monitored iff we have received a message
+ %% from it. In this case we just want to avoid doing work if we
+ %% never got any messages.
{ok, case pmon:is_monitored(ChPid, KS) of
false -> State;
true -> MS1 = case dict:find(ChPid, SQ) of