summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-08-17 12:20:22 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-08-17 12:20:22 +0100
commitc9ecb104b823054dfda5333d2aa8f6f019882d1d (patch)
tree257d1e863c0fb0cfcf671bf2998b1950e888287e
parent2a90f311a41950d9c2c528ec857a2705d29caa96 (diff)
downloadrabbitmq-server-bug23132.tar.gz
Minor correctionsbug23132
-rw-r--r--src/file_handle_cache.erl9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl
index 2014b19f..19b2654f 100644
--- a/src/file_handle_cache.erl
+++ b/src/file_handle_cache.erl
@@ -767,17 +767,18 @@ handle_call({obtain, Pid}, From, State = #fhc_state { obtain_count = Count,
handle_call({open, Pid, EldestUnusedSince, CanClose}, From,
State = #fhc_state { open_count = Count,
open_pending = Pending,
- elders = Elders }) ->
+ elders = Elders }) ->
Elders1 = dict:store(Pid, EldestUnusedSince, Elders),
- case maybe_reduce(State #fhc_state { open_count = Count + 1,
- elders = Elders1 }) of
+ case maybe_reduce(
+ ensure_mref(Pid, State #fhc_state { open_count = Count + 1,
+ elders = Elders1 })) of
{true, State1} ->
State2 = State1 #fhc_state { open_count = Count },
case CanClose of
true -> {reply, close, State2};
false -> {noreply, State2 #fhc_state {
open_pending = [From | Pending],
- elders = Elders }}
+ elders = dict:erase(Pid, Elders1) }}
end;
{false, State1} ->
{reply, ok, State1}