Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions include/asio/detail/win_iocp_file_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ class win_iocp_file_service :
const ConstBufferSequence& buffers, asio::error_code& ec)
{
uint64_t offset = impl.offset_;
impl.offset_ += asio::buffer_size(buffers);
// The handle service submits the first non-empty buffer of the sequence and
// no more, so the position advances by that buffer alone. The composed
// operations resume from the new position with the buffers left over.
impl.offset_ += buffer_sequence_adapter<asio::const_buffer,
ConstBufferSequence>::first(buffers).size();
return handle_service_.write_some_at(impl, offset, buffers, ec);
}

Expand All @@ -183,7 +187,8 @@ class win_iocp_file_service :
Handler& handler, const IoExecutor& io_ex)
{
uint64_t offset = impl.offset_;
impl.offset_ += asio::buffer_size(buffers);
impl.offset_ += buffer_sequence_adapter<asio::const_buffer,
ConstBufferSequence>::first(buffers).size();
handle_service_.async_write_some_at(impl, offset, buffers, handler, io_ex);
}

Expand Down Expand Up @@ -212,7 +217,8 @@ class win_iocp_file_service :
const MutableBufferSequence& buffers, asio::error_code& ec)
{
uint64_t offset = impl.offset_;
impl.offset_ += asio::buffer_size(buffers);
impl.offset_ += buffer_sequence_adapter<asio::mutable_buffer,
MutableBufferSequence>::first(buffers).size();
return handle_service_.read_some_at(impl, offset, buffers, ec);
}

Expand All @@ -225,7 +231,8 @@ class win_iocp_file_service :
Handler& handler, const IoExecutor& io_ex)
{
uint64_t offset = impl.offset_;
impl.offset_ += asio::buffer_size(buffers);
impl.offset_ += buffer_sequence_adapter<asio::mutable_buffer,
MutableBufferSequence>::first(buffers).size();
handle_service_.async_read_some_at(impl, offset, buffers, handler, io_ex);
}

Expand Down