diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2010-08-20 14:14:34 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2010-08-20 14:14:34 +0100 |
commit | f9b196d2fe12d3f88d318338170f9eb73067648e (patch) | |
tree | 53be3465125b54203b292056ee0d68a878e75729 | |
parent | f08a83d1fc8c463d536aab9e542a98d695db5d87 (diff) | |
download | rabbitmq-server-f9b196d2fe12d3f88d318338170f9eb73067648e.tar.gz |
Given the clients are demanded to close all open fds when asked to, them sending a boolean is irrelvant now
-rw-r--r-- | src/file_handle_cache.erl | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl index 0ecb2e6d..c49eae7c 100644 --- a/src/file_handle_cache.erl +++ b/src/file_handle_cache.erl @@ -538,8 +538,7 @@ age_tree_insert(Now, Ref) -> Tree = get_age_tree(), Tree1 = gb_trees:insert(Now, Ref, Tree), {Oldest, _Ref} = gb_trees:smallest(Tree1), - case gen_server:call(?SERVER, {open, self(), Oldest, - not gb_trees:is_empty(Tree)}, infinity) of + case gen_server:call(?SERVER, {open, self(), Oldest}, infinity) of ok -> put_age_tree(Tree1); close -> @@ -749,7 +748,7 @@ init([]) -> due_no_open = sets:new(), timer_ref = undefined }}. -handle_call({open, Pid, EldestUnusedSince, CanClose}, From, +handle_call({open, Pid, EldestUnusedSince}, From, State = #fhc_state { open_count = Count, open_pending = Pending, elders = Elders, @@ -760,16 +759,16 @@ handle_call({open, Pid, EldestUnusedSince, CanClose}, From, Item = {open, Pid, From}, State1 = ensure_mref(Pid, State #fhc_state { elders = Elders1 }), case needs_reduce(State1 #fhc_state { open_count = Count + 1 }) of - true -> case CanClose of - true -> - {reply, close, - State1 #fhc_state { - due_no_open = sets:add_element(Pid, DueNoOpen) }}; - false -> + true -> case dict:fetch(Pid, State1#fhc_state.counts) of + {0, _} -> {noreply, reduce(State1 #fhc_state { open_pending = [Item | Pending], - blocked = sets:add_element(Pid, Blocked) })} + blocked = sets:add_element(Pid, Blocked) })}; + _ -> + {reply, close, + State1 #fhc_state { + due_no_open = sets:add_element(Pid, DueNoOpen) }} end; false -> {noreply, run_pending_item(Item, State1)} end; |