summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2011-01-09 17:00:54 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2011-01-09 17:00:54 +0000
commite14e75414167d0b2ee988da81d016d7fb2989951 (patch)
tree0aa06873b57b564fb97c6ca21917de04f3871e4e
parent1111d2a20da7502d325b95f1d4357c35fc6171cc (diff)
downloadrabbitmq-server-git-e14e75414167d0b2ee988da81d016d7fb2989951.tar.gz
simplifying refactor
-rw-r--r--src/rabbit_msg_store.erl37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl
index a85de45356..f532a9118b 100644
--- a/src/rabbit_msg_store.erl
+++ b/src/rabbit_msg_store.erl
@@ -1121,28 +1121,21 @@ client_confirm(CRef, Guids,
%% itself.
should_mask_action(CRef, Guid,
State = #msstate { dying_clients_ets = DyingClientsEts }) ->
- Location = index_lookup(Guid, State),
- {case ets:lookup(DyingClientsEts, CRef) of
- [] ->
- false;
- [{_CRef, const}] ->
- case Location of
- not_found ->
- true;
- #msg_location { file = File, offset = Offset,
- ref_count = RefCount } ->
- #msg_location { file = DeathFile, offset = DeathOffset } =
- index_lookup(CRef, State),
- case {DeathFile, DeathOffset} < {File, Offset} of
- true -> true;
- false -> case RefCount of
- 0 -> false_if_increment;
- _ -> false
- end
- end
- end
- end, Location}.
-
+ case {ets:lookup(DyingClientsEts, CRef), index_lookup(Guid, State)} of
+ {[], Location} ->
+ {false, Location};
+ {[{_CRef, const}], not_found} ->
+ {true, not_found};
+ {[{_CRef, const}], #msg_location { file = File, offset = Offset,
+ ref_count = RefCount } = Location} ->
+ #msg_location { file = DeathFile, offset = DeathOffset } =
+ index_lookup(CRef, State),
+ {case {{DeathFile, DeathOffset} < {File, Offset}, RefCount} of
+ {true, _} -> true;
+ {false, 0} -> false_if_increment;
+ {false, _} -> false
+ end, Location}
+ end.
%%----------------------------------------------------------------------------
%% file helper functions