summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-13 14:55:38 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-13 14:55:38 +0100
commite33c9c1550898dacd6fc97bd3ae9c55a455dac92 (patch)
treed5137462951520b88653a96b76438907e5cda2d0
parentd146bcbd9069a3c93b45bfcbf43d72ccc56896bc (diff)
downloadrabbitmq-server-e33c9c1550898dacd6fc97bd3ae9c55a455dac92.tar.gz
refactor
-rw-r--r--src/rabbit_channel.erl19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index fc3d2c9a..448467d8 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -325,12 +325,11 @@ handle_info(emit_stats, State = #ch{stats_timer = StatsTimer}) ->
handle_info({'DOWN', MRef, process, QPid, Reason},
State = #ch{consumer_monitors = ConsumerMonitors}) ->
+ State1 = handle_publishing_queue_down(QPid, Reason, State),
noreply(
case dict:find(MRef, ConsumerMonitors) of
- error ->
- handle_publishing_queue_down(QPid, Reason, State);
- {ok, ConsumerTag} ->
- handle_consuming_queue_down(MRef, ConsumerTag, State)
+ error -> State1;
+ {ok, ConsumerTag} -> handle_consuming_queue_down(MRef, ConsumerTag, State1)
end);
handle_info({'EXIT', _Pid, Reason}, State) ->
@@ -1129,13 +1128,6 @@ maybe_monitor(QPid) ->
MRef -> MRef
end.
-confirm_maybe_monitor(QPid, UQM) ->
- case gb_trees:is_defined(QPid, UQM) of
- true -> ok;
- false -> maybe_monitor(QPid),
- ok
- end.
-
consumer_maybe_monitor(ConsumerTag, State = #ch{consumer_mapping = ConsumerMapping,
consumer_monitors = ConsumerMonitors,
capabilities = Capabilities}) ->
@@ -1160,7 +1152,8 @@ maybe_demonitor(QPid, #ch{stats_timer = StatsTimer,
QueueBlocked = gb_sets:is_element(QPid, Blocking),
case not StatsEnabled and not ConsumerMonitored and
not QueueBlocked of
- true -> true = erlang:demonitor(MRef);
+ true -> true = erlang:demonitor(MRef),
+ erase({monitoring, QPid});
false -> ok
end,
ok
@@ -1389,7 +1382,7 @@ process_routing_result(routed, QPids, XName, MsgSeqNo, _, State) ->
MsgSeqNos1 = gb_sets:insert(MsgSeqNo, MsgSeqNos),
gb_trees:update(QPid, MsgSeqNos1, UQM2);
none ->
- ok = confirm_maybe_monitor(QPid, UQM2),
+ maybe_monitor(QPid),
gb_trees:insert(QPid, SingletonSet, UQM2)
end
end, UQM, QPids),