diff options
| author | Jerry Kuch <jerryk@vmware.com> | 2010-11-09 15:18:37 +0000 |
|---|---|---|
| committer | Jerry Kuch <jerryk@vmware.com> | 2010-11-09 15:18:37 +0000 |
| commit | b822832adb111aafde6380d9433269ab0046d3dd (patch) | |
| tree | f69f00607090b3952656eb9656cdf790b972b264 | |
| parent | ca92655637ec900894dc2e7f0bc96256b14cb275 (diff) | |
| download | rabbitmq-server-git-b822832adb111aafde6380d9433269ab0046d3dd.tar.gz | |
Move function to be among its relatives.
| -rw-r--r-- | src/rabbit_amqqueue_process.erl | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index d118ddc8af..86be521394 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -315,6 +315,20 @@ ch_record(ChPid) -> store_ch_record(C = #cr{ch_pid = ChPid}) -> put({ch, ChPid}, C). +%% If the channel record we're considering submitting to the process dictionary +%% has no consumers, has no pending acks, and doesn't have a transaction, we +%% should delete its record rather than storing it. +update_ch_record(C = #cr{consumer_count = ConsumerCount, + limiter_pid = LimiterPid, + acktags = ChAckTags, + txn = Txn}) -> + case {sets:size(ChAckTags), ConsumerCount, Txn} of + {0, 0, none} -> demonitor_and_erase_ch(C), + ok = rabbit_limiter:unregister(LimiterPid, self()); + _ -> store_ch_record(C) + end. + + all_ch_record() -> [C || {{ch, _}, C} <- get()]. @@ -1042,18 +1056,6 @@ demonitor_and_erase_ch(#cr{ch_pid = ChPid, erlang:demonitor(MonitorRef), erase({ch, ChPid}). -%% If the channel record we're considering submitting to the process dictionary -%% has no consumers, has no pending acks, and doesn't have a transaction, we -%% should delete its record rather than storing it. -replace_or_erase_ch(C = #cr{consumer_count = ConsumerCount, - limiter_pid = LimiterPid, - acktags = ChAckTags, - txn = Txn}) -> - case {sets:size(ChAckTags), ConsumerCount, Txn} of - {0, 0, undefined} -> demonitor_and_erase_ch(C), - ok = rabbit_limiter:unregister(LimiterPid, self()); - _ -> store_ch_record(C) - end. |
