summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-08-24 13:06:11 +0100
committerMatthew Sackman <matthew@lshift.net>2009-08-24 13:06:11 +0100
commit99b96b785868d61a4a4a07136ee5109515546d2c (patch)
tree0ea48ebfe7dce23a9427af8b8d8b2f0f531ea13f
parent62861adca3511e1c089eb26101e080757e30c158 (diff)
downloadrabbitmq-server-git-99b96b785868d61a4a4a07136ee5109515546d2c.tar.gz
More cosmetics. Also, if the seek failed, it's probably safer to assume that we've not changed position. However, it's really expected life will stop pretty soon after anyway, so it's probably not too important.
-rw-r--r--src/rabbit_handle_cache.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rabbit_handle_cache.erl b/src/rabbit_handle_cache.erl
index b99b8bfba2..fcd79269ef 100644
--- a/src/rabbit_handle_cache.erl
+++ b/src/rabbit_handle_cache.erl
@@ -74,7 +74,7 @@ with_file_handle_at(File, Offset, Fun, State = #hcstate { handles = Handles,
error ->
{ok, Hdl} = file:open(File, Mode),
case dict:size(Handles) < Limit of
- true ->
+ true ->
{Hdl, 0, Handles, Ages};
false ->
{Then, OldFile, Ages2} = gb_trees:take_smallest(Ages),
@@ -87,15 +87,15 @@ with_file_handle_at(File, Offset, Fun, State = #hcstate { handles = Handles,
{Hdl, OldOffset1, Handles, gb_trees:delete(Then, Ages)}
end,
SeekRes = case Offset == OldOffset of
- true -> ok;
+ true -> ok;
false -> case file:position(FileHdl, {bof, Offset}) of
{ok, Offset} -> ok;
- KO -> KO
+ KO -> KO
end
end,
{NewOffset, Result} = case SeekRes of
- ok -> Fun(FileHdl);
- KO1 -> {Offset, KO1}
+ ok -> Fun(FileHdl);
+ KO1 -> {OldOffset, KO1}
end,
Now = now(),
Handles2 = dict:store(File, {FileHdl, NewOffset, Now}, Handles1),