summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-11-25 13:28:31 +0000
committerMatthew Sackman <matthew@lshift.net>2009-11-25 13:28:31 +0000
commitd22715389937e165ac3ffbb7255ef560c5ee61b0 (patch)
tree5c02dfc3f2049ccec64d831db3567b65452b5edf /src
parent373e95a80cf90c3bb7993ea3e8c53e78171cfcc5 (diff)
downloadrabbitmq-server-git-d22715389937e165ac3ffbb7255ef560c5ee61b0.tar.gz
Utterly baffled. I thought this was the obvious refactoring I was doing earlier, but apparently not. Anyway, this works.
Diffstat (limited to 'src')
-rw-r--r--src/file_handle_cache.erl24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl
index bbc09b8af8..740ae169a7 100644
--- a/src/file_handle_cache.erl
+++ b/src/file_handle_cache.erl
@@ -188,24 +188,18 @@ append(Ref, Data) ->
end).
sync(Ref) ->
- with_handles(
+ with_flushed_handles(
[Ref],
fun ([#handle { is_dirty = false, write_buffer = [] }]) ->
ok;
- ([Handle]) ->
- %% write_buffer will set is_dirty, or leave it set if buffer empty
- case write_buffer(Handle) of
- {ok, Handle1 = #handle { hdl = Hdl, offset = Offset,
- is_dirty = true }} ->
- case file:sync(Hdl) of
- ok ->
- {ok, [Handle1 #handle { trusted_offset = Offset,
- is_dirty = false }]};
- Error ->
- {Error, [Handle1]}
- end;
- {Error, Handle1} ->
- {Error, [Handle1]}
+ ([Handle = #handle { hdl = Hdl, offset = Offset,
+ is_dirty = true, write_buffer = [] }]) ->
+ case file:sync(Hdl) of
+ ok ->
+ {ok, [Handle #handle { trusted_offset = Offset,
+ is_dirty = false }]};
+ Error ->
+ {Error, [Handle]}
end
end).