[Boost-bugs] [Boost C++ Libraries] #9723: async_read_until logic bug

Subject: [Boost-bugs] [Boost C++ Libraries] #9723: async_read_until logic bug
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-28 10:01:53

#9723: async_read_until logic bug
 Reporter: anonymous | Owner: chris_kohlhoff
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
  Version: Boost 1.55.0 | Severity: Showstopper
 Keywords: async_read_until |

 Documentation of async_read_until says:
 "If the streambuf's get area already contains the delimiter, this
 asynchronous operation completes immediately"

 However, I noticed that it was not happening and the asynchronous
 operation was never completing if more data was not received.

 A logic bug was found in the file ''boost/asio/impl/read_until.hpp''

 412 // Check if we're done.
 413 if (!start && bytes_to_read == 0)
 414 break;

 "start" is true if it is the first operation in the async_read_until
 composed operation (read_until_delim_op): no async_read_some inside
 read_until_delim_op has been required yet.

 Therefore, the "break" instruction is never reached without first calling
 at least once async_read_some inside read_until_delim_op.
 Thus, '''the asynchronous operation will never complete immediately'''
 even if the delimiter is already contained in the streambuf's get area.

 The provided patch fixes the issue.

 Thanks for amazing asio work, hope this could help.

Ticket URL: <https://svn.boost.org/trac/boost/ticket/9723>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC