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 | 0677f05cec293f9c136cbd287eb617596ac2a75e (patch) | |
tree | f69f00607090b3952656eb9656cdf790b972b264 /src/rabbit_amqqueue_process.erl | |
parent | 655450494ac54c71b55c76f4830b6502a6f039fc (diff) | |
download | rabbitmq-server-0677f05cec293f9c136cbd287eb617596ac2a75e.tar.gz |
Move function to be among its relatives.
Diffstat (limited to 'src/rabbit_amqqueue_process.erl')
-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 d118ddc8..86be5213 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. |