summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Kuch <jerryk@vmware.com>2010-11-09 15:39:42 +0000
committerJerry Kuch <jerryk@vmware.com>2010-11-09 15:39:42 +0000
commit617b83085f85b4a058776564f78382da100e9eeb (patch)
tree7c16fba1ea5bc8445117afc8c4ca001a4f3bf8b5
parentb822832adb111aafde6380d9433269ab0046d3dd (diff)
downloadrabbitmq-server-git-617b83085f85b4a058776564f78382da100e9eeb.tar.gz
basic_cancel and channel_down handlers use new helper methods
-rw-r--r--src/rabbit_amqqueue_process.erl15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 86be521394..1ff4bacb91 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -514,10 +514,8 @@ handle_ch_down(DownPid, State = #q{exclusive_consumer = Holder}) ->
case lookup_ch(DownPid) of
not_found ->
{ok, State};
- #cr{monitor_ref = MonitorRef, ch_pid = ChPid, txn = Txn,
- acktags = ChAckTags} ->
- erlang:demonitor(MonitorRef),
- erase({ch, ChPid}),
+ C = #cr{ch_pid = ChPid, txn = Txn, acktags = ChAckTags} ->
+ demonitor_and_erase_ch(C),
State1 = State#q{
exclusive_consumer = case Holder of
{ChPid, _} -> none;
@@ -840,12 +838,9 @@ handle_call({basic_cancel, ChPid, ConsumerTag, OkMsg}, _From,
not_found ->
ok = maybe_send_reply(ChPid, OkMsg),
reply(ok, State);
- C = #cr{consumer_count = ConsumerCount, limiter_pid = LimiterPid} ->
- store_ch_record(C#cr{consumer_count = ConsumerCount - 1}),
- case ConsumerCount of
- 1 -> ok = rabbit_limiter:unregister(LimiterPid, self());
- _ -> ok
- end,
+ C = #cr{consumer_count = ConsumerCount} ->
+ C1 = C#cr{consumer_count = ConsumerCount-1},
+ update_ch_record(C1),
ok = maybe_send_reply(ChPid, OkMsg),
NewState =
State#q{exclusive_consumer = cancel_holder(ChPid,