summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2011-09-16 15:05:14 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2011-09-16 15:05:14 +0100
commit8e797c8b0deac0bc9b1c2fe8195cfd7ea3bc0362 (patch)
tree7716b92fc329594a059280fedc1ee1bd38eba618
parent9cdb3ad14fc2ba56d943e432160e8fadd20d4017 (diff)
downloadrabbitmq-server-8e797c8b0deac0bc9b1c2fe8195cfd7ea3bc0362.tar.gz
some tweaks for sake of symmetry
...and some cosmetics
-rw-r--r--src/rabbit_channel.erl29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 10697123..cee8d761 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -1126,14 +1126,6 @@ handle_method(_MethodRecord, _Content, _State) ->
%%----------------------------------------------------------------------------
-monitor_queue(QPid, State = #ch{queue_monitors = QMons}) ->
- case (not dict:is_key(QPid, QMons) andalso
- queue_monitor_needed(QPid, State)) of
- true -> MRef = erlang:monitor(process, QPid),
- State#ch{queue_monitors = dict:store(QPid, MRef, QMons)};
- false -> State
- end.
-
consumer_monitor(ConsumerTag,
State = #ch{consumer_mapping = ConsumerMapping,
queue_consumers = QCons,
@@ -1153,15 +1145,20 @@ consumer_monitor(ConsumerTag,
State
end.
+monitor_queue(QPid, State = #ch{queue_monitors = QMons}) ->
+ case (not dict:is_key(QPid, QMons) andalso
+ queue_monitor_needed(QPid, State)) of
+ true -> MRef = erlang:monitor(process, QPid),
+ State#ch{queue_monitors = dict:store(QPid, MRef, QMons)};
+ false -> State
+ end.
+
demonitor_queue(QPid, State = #ch{queue_monitors = QMons}) ->
- case dict:find(QPid, QMons) of
- error -> State;
- {ok, MRef} -> case queue_monitor_needed(QPid, State) of
- false -> true = erlang:demonitor(MRef),
- State#ch{queue_monitors =
- dict:erase(QPid, QMons)};
- true -> State
- end
+ case (dict:is_key(QPid, QMons) andalso
+ not queue_monitor_needed(QPid, State)) of
+ true -> true = erlang:demonitor(dict:fetch(QPid, QMons)),
+ State#ch{queue_monitors = dict:erase(QPid, QMons)};
+ false -> State
end.
queue_monitor_needed(QPid, #ch{stats_timer = StatsTimer,