Update of /cvsroot/boost/boost/libs/asio/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17073/libs/asio/test
Modified Files:
Jamfile Jamfile.v2 buffered_read_stream.cpp
buffered_stream.cpp buffered_write_stream.cpp
deadline_timer.cpp error.cpp read.cpp write.cpp
Removed Files:
error_handler.cpp thread.cpp
Log Message:
Change error handling to match TR2 proposal.
Index: Jamfile
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/Jamfile,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Jamfile 4 Nov 2006 07:14:09 -0000 1.5
+++ Jamfile 8 Nov 2006 05:32:17 -0000 1.6
@@ -7,6 +7,8 @@
subproject libs/asio/test ;
+project boost : $(BOOST_ROOT) ;
+
# bring in the rules for testing
import testing ;
@@ -22,7 +24,8 @@
}
template asio_unit_test
- : <lib>../../../libs/thread/build/boost_thread
+ : <lib>@boost/libs/thread/build/boost_thread
+ <lib>@boost/libs/system/build/boost_system
: <include>../../..
<define>BOOST_ALL_NO_LIB=1
<threading>multi
@@ -33,44 +36,43 @@
test-suite "asio"
:
- [ link basic_datagram_socket.cpp <template>asio_unit_test ]
- [ link basic_deadline_timer.cpp <template>asio_unit_test ]
- [ link basic_socket_acceptor.cpp <template>asio_unit_test ]
- [ link basic_stream_socket.cpp <template>asio_unit_test ]
+ [ run basic_datagram_socket.cpp <template>asio_unit_test ]
+ [ run basic_deadline_timer.cpp <template>asio_unit_test ]
+ [ run basic_socket_acceptor.cpp <template>asio_unit_test ]
+ [ run basic_stream_socket.cpp <template>asio_unit_test ]
[ run buffer.cpp <template>asio_unit_test ]
[ run buffered_read_stream.cpp <template>asio_unit_test ]
[ run buffered_stream.cpp <template>asio_unit_test ]
[ run buffered_write_stream.cpp <template>asio_unit_test ]
- [ link completion_condition.cpp <template>asio_unit_test ]
- [ link datagram_socket_service.cpp <template>asio_unit_test ]
- [ link deadline_timer_service.cpp <template>asio_unit_test ]
+ [ run completion_condition.cpp <template>asio_unit_test ]
+ [ run datagram_socket_service.cpp <template>asio_unit_test ]
+ [ run deadline_timer_service.cpp <template>asio_unit_test ]
[ run deadline_timer.cpp <template>asio_unit_test ]
- [ run error_handler.cpp <template>asio_unit_test ]
[ run error.cpp <template>asio_unit_test ]
[ run io_service.cpp <template>asio_unit_test ]
- [ link ip/address.cpp <template>asio_unit_test ]
- [ link ip/address_v4.cpp <template>asio_unit_test ]
- [ link ip/address_v6.cpp <template>asio_unit_test ]
- [ link ip/basic_endpoint.cpp <template>asio_unit_test ]
- [ link ip/basic_resolver.cpp <template>asio_unit_test ]
- [ link ip/basic_resolver_entry.cpp <template>asio_unit_test ]
- [ link ip/basic_resolver_iterator.cpp <template>asio_unit_test ]
- [ link ip/basic_resolver_query.cpp <template>asio_unit_test ]
+ [ run ip/address.cpp <template>asio_unit_test ]
+ [ run ip/address_v4.cpp <template>asio_unit_test ]
+ [ run ip/address_v6.cpp <template>asio_unit_test ]
+ [ run ip/basic_endpoint.cpp <template>asio_unit_test ]
+ [ run ip/basic_resolver.cpp <template>asio_unit_test ]
+ [ run ip/basic_resolver_entry.cpp <template>asio_unit_test ]
+ [ run ip/basic_resolver_iterator.cpp <template>asio_unit_test ]
+ [ run ip/basic_resolver_query.cpp <template>asio_unit_test ]
[ run ip/host_name.cpp <template>asio_unit_test ]
- [ link ip/multicast.cpp <template>asio_unit_test ]
- [ link ip/resolver_query_base.cpp <template>asio_unit_test ]
- [ link ip/resolver_service.cpp <template>asio_unit_test ]
+ [ run ip/multicast.cpp <template>asio_unit_test ]
+ [ run ip/resolver_query_base.cpp <template>asio_unit_test ]
+ [ run ip/resolver_service.cpp <template>asio_unit_test ]
[ run ip/tcp.cpp <template>asio_unit_test ]
[ run ip/udp.cpp <template>asio_unit_test ]
[ run is_read_buffered.cpp <template>asio_unit_test ]
[ run is_write_buffered.cpp <template>asio_unit_test ]
- [ link placeholders.cpp <template>asio_unit_test ]
+ [ run placeholders.cpp <template>asio_unit_test ]
[ run read.cpp <template>asio_unit_test ]
- [ link read_until.cpp <template>asio_unit_test ]
- [ link socket_acceptor_service.cpp <template>asio_unit_test ]
+ [ run read_until.cpp <template>asio_unit_test ]
+ [ run socket_acceptor_service.cpp <template>asio_unit_test ]
[ run socket_base.cpp <template>asio_unit_test ]
[ run strand.cpp <template>asio_unit_test ]
- [ link stream_socket_service.cpp <template>asio_unit_test ]
- [ link time_traits.cpp <template>asio_unit_test ]
+ [ run stream_socket_service.cpp <template>asio_unit_test ]
+ [ run time_traits.cpp <template>asio_unit_test ]
[ run write.cpp <template>asio_unit_test ]
;
Index: Jamfile.v2
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/Jamfile.v2,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Jamfile.v2 4 Nov 2006 07:14:09 -0000 1.6
+++ Jamfile.v2 8 Nov 2006 05:32:17 -0000 1.7
@@ -28,6 +28,7 @@
project
: requirements
<library>/boost/date_time//boost_date_time
+ <library>/boost/system//boost_system
<library>/boost/thread//boost_thread
<define>BOOST_ALL_NO_LIB=1
<threading>multi
@@ -62,8 +63,6 @@
[ link deadline_timer_service.cpp : $(USE_SELECT) :
deadline_timer_service_select ]
[ run deadline_timer.cpp ]
[ run deadline_timer.cpp : : : $(USE_SELECT) : deadline_timer_select ]
- [ run error_handler.cpp ]
- [ run error_handler.cpp : : : $(USE_SELECT) : error_handler_select ]
[ run error.cpp ]
[ run error.cpp : : : $(USE_SELECT) : error_select ]
[ run io_service.cpp ]
@@ -104,8 +103,8 @@
[ link placeholders.cpp : $(USE_SELECT) : placeholders_select ]
[ run read.cpp ]
[ run read.cpp : : : $(USE_SELECT) : read_select ]
- [ run read_until.cpp ]
- [ run read_until.cpp : : : $(USE_SELECT) : read_until_select ]
+ [ link read_until.cpp ]
+ [ link read_until.cpp : $(USE_SELECT) : read_until_select ]
[ link socket_acceptor_service.cpp ]
[ link socket_acceptor_service.cpp : $(USE_SELECT) :
socket_acceptor_service_select ]
[ run socket_base.cpp ]
Index: buffered_read_stream.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/buffered_read_stream.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- buffered_read_stream.cpp 4 Nov 2006 07:14:09 -0000 1.1
+++ buffered_read_stream.cpp 8 Nov 2006 05:32:17 -0000 1.2
@@ -70,16 +70,14 @@
while (bytes_written < sizeof(write_data))
{
bytes_written += server_socket.write_some(
- boost::asio::buffer(write_buf + bytes_written),
- boost::asio::throw_error());
+ boost::asio::buffer(write_buf + bytes_written));
}
bytes_read = 0;
while (bytes_read < sizeof(read_data))
{
bytes_read += client_socket.read_some(
- boost::asio::buffer(read_buf + bytes_read),
- boost::asio::throw_error());
+ boost::asio::buffer(read_buf + bytes_read));
}
BOOST_CHECK(bytes_written == sizeof(write_data));
@@ -87,23 +85,22 @@
BOOST_CHECK(memcmp(write_data, read_data, sizeof(write_data)) == 0);
server_socket.close();
- boost::asio::error error;
+ boost::system::error_code error;
bytes_read = client_socket.read_some(
- boost::asio::buffer(read_buf),
- boost::asio::assign_error(error));
+ boost::asio::buffer(read_buf), error);
BOOST_CHECK(bytes_read == 0);
BOOST_CHECK(error == boost::asio::error::eof);
- client_socket.close(boost::asio::throw_error());
+ client_socket.close(error);
}
-void handle_accept(const boost::asio::error& e)
+void handle_accept(const boost::system::error_code& e)
{
BOOST_CHECK(!e);
}
-void handle_write(const boost::asio::error& e,
+void handle_write(const boost::system::error_code& e,
std::size_t bytes_transferred,
std::size_t* total_bytes_written)
{
@@ -113,7 +110,7 @@
*total_bytes_written += bytes_transferred;
}
-void handle_read(const boost::asio::error& e,
+void handle_read(const boost::system::error_code& e,
std::size_t bytes_transferred,
std::size_t* total_bytes_read)
{
@@ -123,7 +120,7 @@
*total_bytes_read += bytes_transferred;
}
-void handle_read_eof(const boost::asio::error& e,
+void handle_read_eof(const boost::system::error_code& e,
std::size_t bytes_transferred)
{
BOOST_CHECK(e == boost::asio::error::eof);
Index: buffered_stream.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/buffered_stream.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- buffered_stream.cpp 4 Nov 2006 07:14:09 -0000 1.1
+++ buffered_stream.cpp 8 Nov 2006 05:32:17 -0000 1.2
@@ -71,17 +71,15 @@
while (bytes_written < sizeof(write_data))
{
bytes_written += server_socket.write_some(
- boost::asio::buffer(write_buf + bytes_written),
- boost::asio::throw_error());
- server_socket.flush(boost::asio::throw_error());
+ boost::asio::buffer(write_buf + bytes_written));
+ server_socket.flush();
}
bytes_read = 0;
while (bytes_read < sizeof(read_data))
{
bytes_read += client_socket.read_some(
- boost::asio::buffer(read_buf + bytes_read),
- boost::asio::throw_error());
+ boost::asio::buffer(read_buf + bytes_read));
}
BOOST_CHECK(bytes_written == sizeof(write_data));
@@ -89,23 +87,22 @@
BOOST_CHECK(memcmp(write_data, read_data, sizeof(write_data)) == 0);
server_socket.close();
- boost::asio::error error;
+ boost::system::error_code error;
bytes_read = client_socket.read_some(
- boost::asio::buffer(read_buf),
- boost::asio::assign_error(error));
+ boost::asio::buffer(read_buf), error);
BOOST_CHECK(bytes_read == 0);
BOOST_CHECK(error == boost::asio::error::eof);
- client_socket.close(boost::asio::throw_error());
+ client_socket.close(error);
}
-void handle_accept(const boost::asio::error& e)
+void handle_accept(const boost::system::error_code& e)
{
BOOST_CHECK(!e);
}
-void handle_write(const boost::asio::error& e,
+void handle_write(const boost::system::error_code& e,
std::size_t bytes_transferred,
std::size_t* total_bytes_written)
{
@@ -115,12 +112,12 @@
*total_bytes_written += bytes_transferred;
}
-void handle_flush(const boost::asio::error& e)
+void handle_flush(const boost::system::error_code& e)
{
BOOST_CHECK(!e);
}
-void handle_read(const boost::asio::error& e,
+void handle_read(const boost::system::error_code& e,
std::size_t bytes_transferred,
std::size_t* total_bytes_read)
{
@@ -130,7 +127,7 @@
*total_bytes_read += bytes_transferred;
}
-void handle_read_eof(const boost::asio::error& e,
+void handle_read_eof(const boost::system::error_code& e,
std::size_t bytes_transferred)
{
BOOST_CHECK(e == boost::asio::error::eof);
Index: buffered_write_stream.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/buffered_write_stream.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- buffered_write_stream.cpp 4 Nov 2006 07:14:09 -0000 1.1
+++ buffered_write_stream.cpp 8 Nov 2006 05:32:17 -0000 1.2
@@ -71,17 +71,15 @@
while (bytes_written < sizeof(write_data))
{
bytes_written += server_socket.write_some(
- boost::asio::buffer(write_buf + bytes_written),
- boost::asio::throw_error());
- server_socket.flush(boost::asio::throw_error());
+ boost::asio::buffer(write_buf + bytes_written));
+ server_socket.flush();
}
bytes_read = 0;
while (bytes_read < sizeof(read_data))
{
bytes_read += client_socket.read_some(
- boost::asio::buffer(read_buf + bytes_read),
- boost::asio::throw_error());
+ boost::asio::buffer(read_buf + bytes_read));
}
BOOST_CHECK(bytes_written == sizeof(write_data));
@@ -89,23 +87,22 @@
BOOST_CHECK(memcmp(write_data, read_data, sizeof(write_data)) == 0);
server_socket.close();
- boost::asio::error error;
+ boost::system::error_code error;
bytes_read = client_socket.read_some(
- boost::asio::buffer(read_buf),
- boost::asio::assign_error(error));
+ boost::asio::buffer(read_buf), error);
BOOST_CHECK(bytes_read == 0);
BOOST_CHECK(error == boost::asio::error::eof);
- client_socket.close(boost::asio::throw_error());
+ client_socket.close(error);
}
-void handle_accept(const boost::asio::error& e)
+void handle_accept(const boost::system::error_code& e)
{
BOOST_CHECK(!e);
}
-void handle_write(const boost::asio::error& e,
+void handle_write(const boost::system::error_code& e,
std::size_t bytes_transferred,
std::size_t* total_bytes_written)
{
@@ -115,12 +112,12 @@
*total_bytes_written += bytes_transferred;
}
-void handle_flush(const boost::asio::error& e)
+void handle_flush(const boost::system::error_code& e)
{
BOOST_CHECK(!e);
}
-void handle_read(const boost::asio::error& e,
+void handle_read(const boost::system::error_code& e,
std::size_t bytes_transferred,
std::size_t* total_bytes_read)
{
@@ -130,7 +127,7 @@
*total_bytes_read += bytes_transferred;
}
-void handle_read_eof(const boost::asio::error& e,
+void handle_read_eof(const boost::system::error_code& e,
std::size_t bytes_transferred)
{
BOOST_CHECK(e == boost::asio::error::eof);
Index: deadline_timer.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/deadline_timer.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- deadline_timer.cpp 4 Nov 2006 07:14:09 -0000 1.1
+++ deadline_timer.cpp 8 Nov 2006 05:32:17 -0000 1.2
@@ -43,9 +43,10 @@
}
}
-void increment_if_not_cancelled(int* count, const boost::asio::error& e)
+void increment_if_not_cancelled(int* count,
+ const boost::system::error_code& ec)
{
- if (!e)
+ if (!ec)
++(*count);
}
Index: error.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/error.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- error.cpp 4 Nov 2006 07:14:09 -0000 1.1
+++ error.cpp 8 Nov 2006 05:32:17 -0000 1.2
@@ -19,27 +19,26 @@
#include <sstream>
#include "unit_test.hpp"
-void test_error_code(int code)
+void test_error_code(const boost::system::error_code& code)
{
- boost::asio::error error(code);
- BOOST_CHECK(code == error.code());
- BOOST_CHECK(error.what() != 0);
+ boost::system::error_code error(code);
+ BOOST_CHECK(code == error);
BOOST_CHECK(code == 0 || error);
BOOST_CHECK(code == 0 || !!error);
- boost::asio::error error2(error);
+ boost::system::error_code error2(error);
BOOST_CHECK(error == error2);
BOOST_CHECK(!(error != error2));
- boost::asio::error error3;
+ boost::system::error_code error3;
error3 = error;
BOOST_CHECK(error == error3);
BOOST_CHECK(!(error != error3));
std::ostringstream os;
os << error;
- BOOST_CHECK(os.str() == error.what());
+ BOOST_CHECK(!os.str().empty());
}
void error_test()
Index: read.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/read.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- read.cpp 4 Nov 2006 07:14:09 -0000 1.1
+++ read.cpp 8 Nov 2006 05:32:17 -0000 1.2
@@ -29,7 +29,6 @@
{
public:
typedef boost::asio::io_service io_service_type;
- typedef boost::asio::error error_type;
test_stream(boost::asio::io_service& io_service)
: io_service_(io_service),
@@ -106,9 +105,11 @@
return total_length;
}
- template <typename Mutable_Buffers, typename Error_Handler>
- size_t read_some(const Mutable_Buffers& buffers, Error_Handler)
+ template <typename Mutable_Buffers>
+ size_t read_some(const Mutable_Buffers& buffers,
+ boost::system::error_code& ec)
{
+ ec = boost::asio::error::success;
return read_some(buffers);
}
@@ -116,9 +117,8 @@
void async_read_some(const Mutable_Buffers& buffers, Handler handler)
{
size_t bytes_transferred = read_some(buffers);
- boost::asio::error error;
- io_service_.post(
- boost::asio::detail::bind_handler(handler, error, bytes_transferred));
+ io_service_.post(boost::asio::detail::bind_handler(
+ handler, boost::asio::error::success, bytes_transferred));
}
private:
@@ -273,9 +273,9 @@
s.reset(read_data, sizeof(read_data));
memset(read_buf, 0, sizeof(read_buf));
- boost::asio::error error;
+ boost::system::error_code error;
size_t bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_all(), boost::asio::assign_error(error));
+ boost::asio::transfer_all(), error);
BOOST_CHECK(bytes_transferred == sizeof(read_data));
BOOST_CHECK(s.check(buffers, sizeof(read_data)));
BOOST_CHECK(!error);
@@ -283,9 +283,9 @@
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_all(), boost::asio::assign_error(error));
+ boost::asio::transfer_all(), error);
BOOST_CHECK(bytes_transferred == sizeof(read_data));
BOOST_CHECK(s.check(buffers, sizeof(read_data)));
BOOST_CHECK(!error);
@@ -293,18 +293,18 @@
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_all(), boost::asio::assign_error(error));
+ boost::asio::transfer_all(), error);
BOOST_CHECK(bytes_transferred == sizeof(read_data));
BOOST_CHECK(s.check(buffers, sizeof(read_data)));
BOOST_CHECK(!error);
s.reset(read_data, sizeof(read_data));
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(1), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(1), error);
BOOST_CHECK(bytes_transferred == sizeof(read_data));
BOOST_CHECK(s.check(buffers, sizeof(read_data)));
BOOST_CHECK(!error);
@@ -312,9 +312,9 @@
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(1), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(1), error);
BOOST_CHECK(bytes_transferred == 1);
BOOST_CHECK(s.check(buffers, 1));
BOOST_CHECK(!error);
@@ -322,18 +322,18 @@
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(1), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(1), error);
BOOST_CHECK(bytes_transferred == 10);
BOOST_CHECK(s.check(buffers, 10));
BOOST_CHECK(!error);
s.reset(read_data, sizeof(read_data));
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(10), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(10), error);
BOOST_CHECK(bytes_transferred == sizeof(read_data));
BOOST_CHECK(s.check(buffers, sizeof(read_data)));
BOOST_CHECK(!error);
@@ -341,9 +341,9 @@
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(10), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(10), error);
BOOST_CHECK(bytes_transferred == 10);
BOOST_CHECK(s.check(buffers, 10));
BOOST_CHECK(!error);
@@ -351,18 +351,18 @@
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(10), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(10), error);
BOOST_CHECK(bytes_transferred == 10);
BOOST_CHECK(s.check(buffers, 10));
BOOST_CHECK(!error);
s.reset(read_data, sizeof(read_data));
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(42), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(42), error);
BOOST_CHECK(bytes_transferred == sizeof(read_data));
BOOST_CHECK(s.check(buffers, sizeof(read_data)));
BOOST_CHECK(!error);
@@ -370,9 +370,9 @@
s.reset(read_data, sizeof(read_data));
s.next_read_length(1);
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(42), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(42), error);
BOOST_CHECK(bytes_transferred == 42);
BOOST_CHECK(s.check(buffers, 42));
BOOST_CHECK(!error);
@@ -380,16 +380,16 @@
s.reset(read_data, sizeof(read_data));
s.next_read_length(10);
memset(read_buf, 0, sizeof(read_buf));
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(42), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(42), error);
BOOST_CHECK(bytes_transferred == 50);
BOOST_CHECK(s.check(buffers, 50));
BOOST_CHECK(!error);
}
-void async_read_handler(const boost::asio::error& e, size_t bytes_transferred,
- size_t expected_bytes_transferred, bool* called)
+void async_read_handler(const boost::system::error_code& e,
+ size_t bytes_transferred, size_t expected_bytes_transferred, bool* called)
{
*called = true;
BOOST_CHECK(!e);
Index: write.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/asio/test/write.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- write.cpp 4 Nov 2006 07:14:09 -0000 1.1
+++ write.cpp 8 Nov 2006 05:32:17 -0000 1.2
@@ -29,7 +29,6 @@
{
public:
typedef boost::asio::io_service io_service_type;
- typedef boost::asio::error error_type;
test_stream(boost::asio::io_service& io_service)
: io_service_(io_service),
@@ -108,9 +107,10 @@
return total_length;
}
- template <typename Const_Buffers, typename Error_Handler>
- size_t write_some(const Const_Buffers& buffers, Error_Handler)
+ template <typename Const_Buffers>
+ size_t write_some(const Const_Buffers& buffers, boost::system::error_code&
ec)
{
+ ec = boost::asio::error::success;
return write_some(buffers);
}
@@ -118,9 +118,8 @@
void async_write_some(const Const_Buffers& buffers, Handler handler)
{
size_t bytes_transferred = write_some(buffers);
- boost::asio::error error;
- io_service_.post(
- boost::asio::detail::bind_handler(handler, error, bytes_transferred));
+ io_service_.post(boost::asio::detail::bind_handler(
+ handler, boost::asio::error::success, bytes_transferred));
}
private:
@@ -256,112 +255,112 @@
= boost::asio::buffer(write_data, sizeof(write_data));
s.reset();
- boost::asio::error error;
+ boost::system::error_code error;
size_t bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_all(), boost::asio::assign_error(error));
+ boost::asio::transfer_all(), error);
BOOST_CHECK(bytes_transferred == sizeof(write_data));
BOOST_CHECK(s.check(buffers, sizeof(write_data)));
BOOST_CHECK(!error);
s.reset();
s.next_write_length(1);
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_all(), boost::asio::assign_error(error));
+ boost::asio::transfer_all(), error);
BOOST_CHECK(bytes_transferred == sizeof(write_data));
BOOST_CHECK(s.check(buffers, sizeof(write_data)));
BOOST_CHECK(!error);
s.reset();
s.next_write_length(10);
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_all(), boost::asio::assign_error(error));
+ boost::asio::transfer_all(), error);
BOOST_CHECK(bytes_transferred == sizeof(write_data));
BOOST_CHECK(s.check(buffers, sizeof(write_data)));
BOOST_CHECK(!error);
s.reset();
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_at_least(1), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(1), error);
BOOST_CHECK(bytes_transferred == sizeof(write_data));
BOOST_CHECK(s.check(buffers, sizeof(write_data)));
BOOST_CHECK(!error);
s.reset();
s.next_write_length(1);
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_at_least(1), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(1), error);
BOOST_CHECK(bytes_transferred == 1);
BOOST_CHECK(s.check(buffers, 1));
BOOST_CHECK(!error);
s.reset();
s.next_write_length(10);
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_at_least(1), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(1), error);
BOOST_CHECK(bytes_transferred == 10);
BOOST_CHECK(s.check(buffers, 10));
BOOST_CHECK(!error);
s.reset();
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_at_least(10), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(10), error);
BOOST_CHECK(bytes_transferred == sizeof(write_data));
BOOST_CHECK(s.check(buffers, sizeof(write_data)));
BOOST_CHECK(!error);
s.reset();
s.next_write_length(1);
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_at_least(10), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(10), error);
BOOST_CHECK(bytes_transferred == 10);
BOOST_CHECK(s.check(buffers, 10));
BOOST_CHECK(!error);
s.reset();
s.next_write_length(10);
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_at_least(10), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(10), error);
BOOST_CHECK(bytes_transferred == 10);
BOOST_CHECK(s.check(buffers, 10));
BOOST_CHECK(!error);
s.reset();
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_at_least(42), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(42), error);
BOOST_CHECK(bytes_transferred == sizeof(write_data));
BOOST_CHECK(s.check(buffers, sizeof(write_data)));
BOOST_CHECK(!error);
s.reset();
s.next_write_length(1);
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_at_least(42), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(42), error);
BOOST_CHECK(bytes_transferred == 42);
BOOST_CHECK(s.check(buffers, 42));
BOOST_CHECK(!error);
s.reset();
s.next_write_length(10);
- error = boost::asio::error();
+ error = boost::system::error_code();
bytes_transferred = boost::asio::write(s, buffers,
- boost::asio::transfer_at_least(42), boost::asio::assign_error(error));
+ boost::asio::transfer_at_least(42), error);
BOOST_CHECK(bytes_transferred == 50);
BOOST_CHECK(s.check(buffers, 50));
BOOST_CHECK(!error);
}
-void async_write_handler(const boost::asio::error& e, size_t bytes_transferred,
- size_t expected_bytes_transferred, bool* called)
+void async_write_handler(const boost::system::error_code& e,
+ size_t bytes_transferred, size_t expected_bytes_transferred, bool* called)
{
*called = true;
BOOST_CHECK(!e);
--- error_handler.cpp DELETED ---
--- thread.cpp DELETED ---
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs