Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#6310 closed Bugs (fixed)

Buffered write stream broken

Reported by: anonymous-bp Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.47.0 Severity: Regression
Keywords: Cc:

Description

Buffered write stream does not work at all in 1.47.0 or 1.48.0 (it did work in 1.45.0, I haven't checked 1.46).

This should fix it:

+++ boost_1_48_0/boost/asio/buffered_write_stream.hpp
@@ -335,7 +335,7 @@
     std::size_t bytes_avail = boost::asio::buffer_size(buffers);
     std::size_t length = bytes_avail < space_avail ? bytes_avail : space_avail;
     storage_.resize(orig_size + length);
-    return boost::asio::buffer_copy(storage_.data(), buffers, length);
+    return boost::asio::buffer_copy(storage_.data() + orig_size, buffers, length);
   }
 
   /// The next layer.

Change History (5)

comment:1 by chris_kohlhoff, 11 years ago

(In [76426]) Fix regression in buffered_write_stream. Refs #6310.

comment:2 by chris_kohlhoff, 11 years ago

Resolution: fixed
Status: newclosed

(In [76516]) Merge from trunk:

  • Chrono support.
  • Added object_handle support.
  • Need to enable the basic_handle class when object_handle is supported.
  • Update copyright notices.
  • Fix MSVC "performance warning".
  • Fix for NetBSD. Fixes #6098.
  • Fix regression in buffered_write_stream. Fixes #6310.
  • Fix deadlock on Mac OS X. Fixes #6275.
  • On linux, connect can return EAGAIN in certain circumstances. Remap to another error so that it doesn't look like a non-blocking operation. Fixes #6048.
  • Fix non-paged pool "leak" on Windows when io_service is repeatedly run without anything to do. Fixes #6321.
  • Disable object_handle on Windows CE.
  • Add extra include required for OVERLAPPED struct.
  • Fix doxygen comments.
  • Update documentation.
  • Add missing class.
  • Update copyright year.

comment:3 by anonymous, 10 years ago

Is it possible that this same issue affects the write_some_handler::operator() in buffered_write_stream.hpp? It appears that in previous code it was also appending orig_size to the destination buffer.

comment:4 by chris_kohlhoff, 10 years ago

(In [79518]) Fix another regression in buffered_write_stream. Refs #6310

comment:5 by chris_kohlhoff, 10 years ago

(In [79549]) Merge from trunk:

  • Make strand destruction a no-op, to allow strand objects to be destroyed after their associated io_service has been destroyed.
  • Use the thread keyword extension when compiling with gcc on linux x86.
  • Avoid calling work_finished() if a completion handler creates more work.
  • Eliminate redundant call to call_stack::contains(this) when dispatching a completion handler.
  • Add support for some newer versions of glibc which provide the epoll_create1 function but always fail with ENOSYS. Fixes #7012
  • Use SSE2 load and store fences.
  • Throw exception if SSL engine initialisation fails. Fixes #6303
  • Fix another regression in buffered_write_stream. Fixes #6310
Note: See TracTickets for help on using tickets.