diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-11-25 13:35:30 +0000 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-11-25 13:35:30 +0000 |
| commit | 9fa61279a0b00ee622c336b0c6c12fa2f983bf21 (patch) | |
| tree | 3be19a4a79a2ac9a2bf6eab22e5b2daab6da52a4 /src | |
| parent | b8b9490d8cd02180689dfc539dc3475f47046744 (diff) | |
| parent | d22715389937e165ac3ffbb7255ef560c5ee61b0 (diff) | |
| download | rabbitmq-server-git-9fa61279a0b00ee622c336b0c6c12fa2f983bf21.tar.gz | |
merging heads
Diffstat (limited to 'src')
| -rw-r--r-- | src/file_handle_cache.erl | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl index 3aace20a46..a3ebd7a59e 100644 --- a/src/file_handle_cache.erl +++ b/src/file_handle_cache.erl @@ -206,24 +206,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). |
