|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49495 - in branches/release: . boost/asio/detail boost/asio/impl libs/asio/test
From: chris_at_[hidden]
Date: 2008-10-30 19:24:24
Author: chris_kohlhoff
Date: 2008-10-30 19:24:23 EDT (Thu, 30 Oct 2008)
New Revision: 49495
URL: http://svn.boost.org/trac/boost/changeset/49495
Log:
Merged revisions 49482,49484 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r49482 | chris_kohlhoff | 2008-10-29 23:49:05 +1100 (Wed, 29 Oct 2008) | 3 lines
Fix problem in read_until's match_condition handling when the delimiter
lies at the end of the data.
........
r49484 | chris_kohlhoff | 2008-10-30 00:00:24 +1100 (Thu, 30 Oct 2008) | 2 lines
Fix scoped_ptr usage to work with Sun Studio 11.
........
Properties modified:
branches/release/ (props changed)
Text files modified:
branches/release/boost/asio/detail/resolver_service.hpp | 2
branches/release/boost/asio/impl/read_until.ipp | 69 +++++------
branches/release/libs/asio/test/read_until.cpp | 237 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 268 insertions(+), 40 deletions(-)
Modified: branches/release/boost/asio/detail/resolver_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/resolver_service.hpp (original)
+++ branches/release/boost/asio/detail/resolver_service.hpp 2008-10-30 19:24:23 EDT (Thu, 30 Oct 2008)
@@ -330,7 +330,7 @@
void start_work_thread()
{
boost::asio::detail::mutex::scoped_lock lock(mutex_);
- if (work_thread_ == 0)
+ if (!work_thread_)
{
work_thread_.reset(new boost::asio::detail::thread(
work_io_service_runner(*work_io_service_)));
Modified: branches/release/boost/asio/impl/read_until.ipp
==============================================================================
--- branches/release/boost/asio/impl/read_until.ipp (original)
+++ branches/release/boost/asio/impl/read_until.ipp 2008-10-30 19:24:23 EDT (Thu, 30 Oct 2008)
@@ -278,19 +278,16 @@
// Look for a match.
std::pair<iterator, bool> result = match_condition(start, end);
- if (result.first != end)
+ if (result.second)
{
- if (result.second)
- {
- // Full match. We're done.
- ec = boost::system::error_code();
- return result.first - begin;
- }
- else
- {
- // Partial match. Next search needs to start from beginning of match.
- next_search_start = result.first - begin;
- }
+ // Full match. We're done.
+ ec = boost::system::error_code();
+ return result.first - begin;
+ }
+ else if (result.first != end)
+ {
+ // Partial match. Next search needs to start from beginning of match.
+ next_search_start = result.first - begin;
}
else
{
@@ -858,20 +855,17 @@
// Look for a match.
std::pair<iterator, bool> result = match_condition_(start, end);
- if (result.first != end)
+ if (result.second)
{
- if (result.second)
- {
- // Full match. We're done.
- std::size_t bytes = result.first - begin;
- handler_(ec, bytes);
- return;
- }
- else
- {
- // Partial match. Next search needs to start from beginning of match.
- next_search_start_ = result.first - begin;
- }
+ // Full match. We're done.
+ std::size_t bytes = result.first - begin;
+ handler_(ec, bytes);
+ return;
+ }
+ else if (result.first != end)
+ {
+ // Partial match. Next search needs to start from beginning of match.
+ next_search_start_ = result.first - begin;
}
else
{
@@ -951,21 +945,18 @@
// Look for a match.
std::size_t next_search_start;
std::pair<iterator, bool> result = match_condition(begin, end);
- if (result.first != end)
+ if (result.second)
{
- if (result.second)
- {
- // Full match. We're done.
- boost::system::error_code ec;
- std::size_t bytes = result.first - begin;
- s.get_io_service().post(detail::bind_handler(handler, ec, bytes));
- return;
- }
- else
- {
- // Partial match. Next search needs to start from beginning of match.
- next_search_start = result.first - begin;
- }
+ // Full match. We're done.
+ boost::system::error_code ec;
+ std::size_t bytes = result.first - begin;
+ s.get_io_service().post(detail::bind_handler(handler, ec, bytes));
+ return;
+ }
+ else if (result.first != end)
+ {
+ // Partial match. Next search needs to start from beginning of match.
+ next_search_start = result.first - begin;
}
else
{
Modified: branches/release/libs/asio/test/read_until.cpp
==============================================================================
--- branches/release/libs/asio/test/read_until.cpp (original)
+++ branches/release/libs/asio/test/read_until.cpp 2008-10-30 19:24:23 EDT (Thu, 30 Oct 2008)
@@ -121,52 +121,81 @@
boost::system::error_code ec;
s.reset(read_data, sizeof(read_data));
+ sb1.consume(sb1.size());
std::size_t length = boost::asio::read_until(s, sb1, 'Z');
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, 'Z');
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, 'Z');
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, 'Z', ec);
BOOST_CHECK(!ec);
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, 'Z', ec);
BOOST_CHECK(!ec);
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, 'Z', ec);
BOOST_CHECK(!ec);
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
+ sb2.consume(sb2.size());
length = boost::asio::read_until(s, sb2, 'Z', ec);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
+ sb2.consume(sb2.size());
length = boost::asio::read_until(s, sb2, 'Z', ec);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
+ sb2.consume(sb2.size());
length = boost::asio::read_until(s, sb2, 'Z', ec);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
+
+ s.reset(read_data, sizeof(read_data));
+ sb2.consume(sb2.size());
+ length = boost::asio::read_until(s, sb2, 'Y', ec);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb2.consume(sb2.size());
+ length = boost::asio::read_until(s, sb2, 'Y', ec);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb2.consume(sb2.size());
+ length = boost::asio::read_until(s, sb2, 'Y', ec);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
}
void test_string_read_until()
@@ -178,52 +207,81 @@
boost::system::error_code ec;
s.reset(read_data, sizeof(read_data));
+ sb1.consume(sb1.size());
std::size_t length = boost::asio::read_until(s, sb1, "XYZ");
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, "XYZ");
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, "XYZ");
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, "XYZ", ec);
BOOST_CHECK(!ec);
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, "XYZ", ec);
BOOST_CHECK(!ec);
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, "XYZ", ec);
BOOST_CHECK(!ec);
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
+ sb2.consume(sb2.size());
length = boost::asio::read_until(s, sb2, "XYZ", ec);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
+ sb2.consume(sb2.size());
length = boost::asio::read_until(s, sb2, "XYZ", ec);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
+ sb2.consume(sb2.size());
length = boost::asio::read_until(s, sb2, "XYZ", ec);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
+
+ s.reset(read_data, sizeof(read_data));
+ sb2.consume(sb2.size());
+ length = boost::asio::read_until(s, sb2, "WXY", ec);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb2.consume(sb2.size());
+ length = boost::asio::read_until(s, sb2, "WXY", ec);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb2.consume(sb2.size());
+ length = boost::asio::read_until(s, sb2, "WXY", ec);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
}
class match_char
@@ -262,52 +320,81 @@
boost::system::error_code ec;
s.reset(read_data, sizeof(read_data));
+ sb1.consume(sb1.size());
std::size_t length = boost::asio::read_until(s, sb1, match_char('Z'));
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, match_char('Z'));
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, match_char('Z'));
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, match_char('Z'), ec);
BOOST_CHECK(!ec);
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, match_char('Z'), ec);
BOOST_CHECK(!ec);
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
+ sb1.consume(sb1.size());
length = boost::asio::read_until(s, sb1, match_char('Z'), ec);
BOOST_CHECK(!ec);
BOOST_CHECK(length == 26);
s.reset(read_data, sizeof(read_data));
+ sb2.consume(sb2.size());
length = boost::asio::read_until(s, sb2, match_char('Z'), ec);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
+ sb2.consume(sb2.size());
length = boost::asio::read_until(s, sb2, match_char('Z'), ec);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
+ sb2.consume(sb2.size());
length = boost::asio::read_until(s, sb2, match_char('Z'), ec);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
+
+ s.reset(read_data, sizeof(read_data));
+ sb2.consume(sb2.size());
+ length = boost::asio::read_until(s, sb2, match_char('Y'), ec);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb2.consume(sb2.size());
+ length = boost::asio::read_until(s, sb2, match_char('Y'), ec);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb2.consume(sb2.size());
+ length = boost::asio::read_until(s, sb2, match_char('Y'), ec);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
}
void async_read_handler(
@@ -333,6 +420,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb1.consume(sb1.size());
boost::asio::async_read_until(s, sb1, 'Z',
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -347,6 +435,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb1.consume(sb1.size());
boost::asio::async_read_until(s, sb1, 'Z',
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -361,6 +450,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb1.consume(sb1.size());
boost::asio::async_read_until(s, sb1, 'Z',
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -374,6 +464,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb2.consume(sb2.size());
boost::asio::async_read_until(s, sb2, 'Z',
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -388,6 +479,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb2.consume(sb2.size());
boost::asio::async_read_until(s, sb2, 'Z',
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -402,6 +494,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb2.consume(sb2.size());
boost::asio::async_read_until(s, sb2, 'Z',
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -410,6 +503,50 @@
BOOST_CHECK(called);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
+
+ s.reset(read_data, sizeof(read_data));
+ ec = boost::system::error_code();
+ length = 0;
+ called = false;
+ sb2.consume(sb2.size());
+ boost::asio::async_read_until(s, sb2, 'Y',
+ boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
+ boost::asio::placeholders::bytes_transferred, &length, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ ec = boost::system::error_code();
+ length = 0;
+ called = false;
+ sb2.consume(sb2.size());
+ boost::asio::async_read_until(s, sb2, 'Y',
+ boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
+ boost::asio::placeholders::bytes_transferred, &length, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ ec = boost::system::error_code();
+ length = 0;
+ called = false;
+ sb2.consume(sb2.size());
+ boost::asio::async_read_until(s, sb2, 'Y',
+ boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
+ boost::asio::placeholders::bytes_transferred, &length, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
}
void test_string_async_read_until()
@@ -426,6 +563,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb1.consume(sb1.size());
boost::asio::async_read_until(s, sb1, "XYZ",
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -440,6 +578,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb1.consume(sb1.size());
boost::asio::async_read_until(s, sb1, "XYZ",
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -454,6 +593,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb1.consume(sb1.size());
boost::asio::async_read_until(s, sb1, "XYZ",
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -467,6 +607,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb2.consume(sb2.size());
boost::asio::async_read_until(s, sb2, "XYZ",
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -481,6 +622,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb2.consume(sb2.size());
boost::asio::async_read_until(s, sb2, "XYZ",
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -495,6 +637,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb2.consume(sb2.size());
boost::asio::async_read_until(s, sb2, "XYZ",
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -503,6 +646,50 @@
BOOST_CHECK(called);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
+
+ s.reset(read_data, sizeof(read_data));
+ ec = boost::system::error_code();
+ length = 0;
+ called = false;
+ sb2.consume(sb2.size());
+ boost::asio::async_read_until(s, sb2, "WXY",
+ boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
+ boost::asio::placeholders::bytes_transferred, &length, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ ec = boost::system::error_code();
+ length = 0;
+ called = false;
+ sb2.consume(sb2.size());
+ boost::asio::async_read_until(s, sb2, "WXY",
+ boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
+ boost::asio::placeholders::bytes_transferred, &length, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ ec = boost::system::error_code();
+ length = 0;
+ called = false;
+ sb2.consume(sb2.size());
+ boost::asio::async_read_until(s, sb2, "WXY",
+ boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
+ boost::asio::placeholders::bytes_transferred, &length, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
}
void test_match_condition_async_read_until()
@@ -519,6 +706,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb1.consume(sb1.size());
boost::asio::async_read_until(s, sb1, match_char('Z'),
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -533,6 +721,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb1.consume(sb1.size());
boost::asio::async_read_until(s, sb1, match_char('Z'),
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -547,6 +736,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb1.consume(sb1.size());
boost::asio::async_read_until(s, sb1, match_char('Z'),
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -560,6 +750,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb2.consume(sb2.size());
boost::asio::async_read_until(s, sb2, match_char('Z'),
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -574,6 +765,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb2.consume(sb2.size());
boost::asio::async_read_until(s, sb2, match_char('Z'),
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -588,6 +780,7 @@
ec = boost::system::error_code();
length = 0;
called = false;
+ sb2.consume(sb2.size());
boost::asio::async_read_until(s, sb2, match_char('Z'),
boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
boost::asio::placeholders::bytes_transferred, &length, &called));
@@ -596,6 +789,50 @@
BOOST_CHECK(called);
BOOST_CHECK(ec == boost::asio::error::not_found);
BOOST_CHECK(length == 0);
+
+ s.reset(read_data, sizeof(read_data));
+ ec = boost::system::error_code();
+ length = 0;
+ called = false;
+ sb2.consume(sb2.size());
+ boost::asio::async_read_until(s, sb2, match_char('Y'),
+ boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
+ boost::asio::placeholders::bytes_transferred, &length, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ ec = boost::system::error_code();
+ length = 0;
+ called = false;
+ sb2.consume(sb2.size());
+ boost::asio::async_read_until(s, sb2, match_char('Y'),
+ boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
+ boost::asio::placeholders::bytes_transferred, &length, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ ec = boost::system::error_code();
+ length = 0;
+ called = false;
+ sb2.consume(sb2.size());
+ boost::asio::async_read_until(s, sb2, match_char('Y'),
+ boost::bind(async_read_handler, boost::asio::placeholders::error, &ec,
+ boost::asio::placeholders::bytes_transferred, &length, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(!ec);
+ BOOST_CHECK(length == 25);
}
test_suite* init_unit_test_suite(int, char*[])
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk