Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49194 - in branches/release: . boost boost/asio boost/asio/detail boost/asio/impl boost/asio/ip boost/asio/posix boost/asio/ssl boost/asio/ssl/detail boost/asio/windows libs/asio/doc libs/asio/example/nonblocking libs/asio/example/windows libs/asio/test libs/asio/test/ip libs/asio/test/posix libs/asio/test/ssl libs/asio/test/windows
From: chris_at_[hidden]
Date: 2008-10-09 01:41:56


Author: chris_kohlhoff
Date: 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
New Revision: 49194
URL: http://svn.boost.org/trac/boost/changeset/49194

Log:
Merge from trunk.

........
  r48414 | chris_kohlhoff | 2008-08-28 22:03:46 +1000 (Thu, 28 Aug 2008) | 2 lines
  
  Fix uninitialised event handles in asio::detail::thread in external mode.
........
  r48415 | chris_kohlhoff | 2008-08-28 22:04:21 +1000 (Thu, 28 Aug 2008) | 2 lines
  
  Fix duplicate variable warning.
........
  r48416 | chris_kohlhoff | 2008-08-28 22:06:42 +1000 (Thu, 28 Aug 2008) | 3 lines
  
  Fix duplicate variable warning. Use get_io_service() rather than
  deprecated io_service() function.
........
  r48417 | chris_kohlhoff | 2008-08-28 22:09:09 +1000 (Thu, 28 Aug 2008) | 2 lines
  
  Use get_io_service() rather than deprecated io_service() function.
........
  r48418 | chris_kohlhoff | 2008-08-28 22:11:47 +1000 (Thu, 28 Aug 2008) | 9 lines
  
  Change the CompletionCondition concept so that:
  - It is now evaluated before the first call to the underlying
    *_some() operation, as well as after every operation.
  - The return value is a number of bytes, which indicates the maximum
    length to be transferred on the subsequent *_some() operation. If
    the return value is 0 then the composed operation completes.
  
  Add missing unit tests for read_at and write_at.
........
  r48490 | chris_kohlhoff | 2008-08-31 18:58:49 +1000 (Sun, 31 Aug 2008) | 2 lines
  
  Don't build serial port test code when serial ports are not available.
........
  r48491 | chris_kohlhoff | 2008-08-31 19:01:59 +1000 (Sun, 31 Aug 2008) | 3 lines
  
  Refactor reactive socket implementation so that synchronous read, write,
  accept and connect operations don't modify data associated with the socket.
........
  r48495 | chris_kohlhoff | 2008-08-31 21:38:52 +1000 (Sun, 31 Aug 2008) | 2 lines
  
  Add class to allow use of arbitrary Windows overlapped I/O operations.
........
  r48524 | chris_kohlhoff | 2008-09-02 09:04:35 +1000 (Tue, 02 Sep 2008) | 3 lines
  
  Add support for using an eventfd descriptor on linux to interrupt a blocked
  epoll/select reactor.
........
  r48525 | chris_kohlhoff | 2008-09-02 09:05:05 +1000 (Tue, 02 Sep 2008) | 3 lines
  
  Use templates to handle iovec structures that have an iov_base member of
  type char*.
........
  r48526 | chris_kohlhoff | 2008-09-02 09:07:29 +1000 (Tue, 02 Sep 2008) | 2 lines
  
  Fix error in comment.
........
  r48527 | chris_kohlhoff | 2008-09-02 18:46:46 +1000 (Tue, 02 Sep 2008) | 2 lines
  
  Fix to compile with MSVC 7.1.
........
  r48535 | chris_kohlhoff | 2008-09-02 21:34:18 +1000 (Tue, 02 Sep 2008) | 2 lines
  
  Add const overloads of the lowest_layer member functions.
........
  r48558 | chris_kohlhoff | 2008-09-03 18:56:43 +1000 (Wed, 03 Sep 2008) | 2 lines
  
  Oops, changeset 48535 accidentally reverted 48527's fix.
........
  r48559 | chris_kohlhoff | 2008-09-03 18:57:48 +1000 (Wed, 03 Sep 2008) | 2 lines
  
  Add a workaround for a possible gcc 4.3 optimiser bug.
........
  r48560 | chris_kohlhoff | 2008-09-03 19:06:10 +1000 (Wed, 03 Sep 2008) | 2 lines
  
  Explicitly specify return type with bind to keep some compilers happy.
........
  r48561 | chris_kohlhoff | 2008-09-03 19:08:04 +1000 (Wed, 03 Sep 2008) | 2 lines
  
  Update completion_condition documentation to match new signature.
........
  r48562 | chris_kohlhoff | 2008-09-03 21:36:43 +1000 (Wed, 03 Sep 2008) | 2 lines
  
  Add windows/transmit_file example.
........
  r48563 | chris_kohlhoff | 2008-09-03 21:46:02 +1000 (Wed, 03 Sep 2008) | 2 lines
  
  Document BOOST_ASIO_DISABLE_EVENTFD macro.
........
  r48564 | chris_kohlhoff | 2008-09-03 21:54:06 +1000 (Wed, 03 Sep 2008) | 2 lines
  
  Add windows::overlapped_ptr to the reference index page.
........
  r48565 | chris_kohlhoff | 2008-09-03 22:28:07 +1000 (Wed, 03 Sep 2008) | 2 lines
  
  Regenerate documentation.
........
  r48683 | chris_kohlhoff | 2008-09-09 22:59:43 +1000 (Tue, 09 Sep 2008) | 2 lines
  
  Add windows example directory.
........
  r48684 | chris_kohlhoff | 2008-09-09 23:00:07 +1000 (Tue, 09 Sep 2008) | 2 lines
  
  Remove generated tags file.
........
  r48685 | chris_kohlhoff | 2008-09-09 23:01:16 +1000 (Tue, 09 Sep 2008) | 2 lines
  
  Version bump.
........
  r48686 | chris_kohlhoff | 2008-09-09 23:02:22 +1000 (Tue, 09 Sep 2008) | 2 lines
  
  Handle SSL library errors.
........
  r48715 | chris_kohlhoff | 2008-09-11 10:05:57 +1000 (Thu, 11 Sep 2008) | 2 lines
  
  Clarify which resolve functions perform forward or reverse resolution.
........

Added:
   branches/release/boost/asio/detail/eventfd_select_interrupter.hpp
      - copied unchanged from r48527, /trunk/boost/asio/detail/eventfd_select_interrupter.hpp
   branches/release/boost/asio/detail/win_iocp_overlapped_ptr.hpp
      - copied, changed from r48495, /trunk/boost/asio/detail/win_iocp_overlapped_ptr.hpp
   branches/release/boost/asio/windows/overlapped_ptr.hpp
      - copied unchanged from r48495, /trunk/boost/asio/windows/overlapped_ptr.hpp
   branches/release/libs/asio/example/windows/
      - copied from r48495, /trunk/libs/asio/example/windows/
   branches/release/libs/asio/example/windows/Jamfile
      - copied unchanged from r48495, /trunk/libs/asio/example/windows/Jamfile
   branches/release/libs/asio/example/windows/Jamfile.v2
      - copied unchanged from r48495, /trunk/libs/asio/example/windows/Jamfile.v2
   branches/release/libs/asio/example/windows/transmit_file.cpp
      - copied unchanged from r48495, /trunk/libs/asio/example/windows/transmit_file.cpp
   branches/release/libs/asio/test/read_at.cpp
      - copied unchanged from r48418, /trunk/libs/asio/test/read_at.cpp
   branches/release/libs/asio/test/windows/overlapped_ptr.cpp
      - copied unchanged from r48495, /trunk/libs/asio/test/windows/overlapped_ptr.cpp
   branches/release/libs/asio/test/write_at.cpp
      - copied unchanged from r48418, /trunk/libs/asio/test/write_at.cpp
Properties modified:
   branches/release/ (props changed)
Text files modified:
   branches/release/boost/asio.hpp | 1
   branches/release/boost/asio/basic_serial_port.hpp | 14
   branches/release/boost/asio/basic_socket.hpp | 14
   branches/release/boost/asio/buffered_read_stream.hpp | 6
   branches/release/boost/asio/buffered_stream.hpp | 6
   branches/release/boost/asio/buffered_write_stream.hpp | 6
   branches/release/boost/asio/buffers_iterator.hpp | 7
   branches/release/boost/asio/completion_condition.hpp | 31
   branches/release/boost/asio/detail/consuming_buffers.hpp | 39 +
   branches/release/boost/asio/detail/descriptor_ops.hpp | 15
   branches/release/boost/asio/detail/reactive_socket_service.hpp | 225 ++++----
   branches/release/boost/asio/detail/select_interrupter.hpp | 3
   branches/release/boost/asio/detail/socket_ops.hpp | 41 +
   branches/release/boost/asio/detail/win_iocp_io_service.hpp | 2
   branches/release/boost/asio/detail/win_iocp_io_service_fwd.hpp | 1
   branches/release/boost/asio/detail/win_iocp_overlapped_ptr.hpp | 4
   branches/release/boost/asio/detail/win_thread.hpp | 5
   branches/release/boost/asio/impl/read.ipp | 67 +
   branches/release/boost/asio/impl/read_at.ipp | 50 +
   branches/release/boost/asio/impl/read_until.ipp | 20
   branches/release/boost/asio/impl/write.ipp | 25
   branches/release/boost/asio/impl/write_at.ipp | 25
   branches/release/boost/asio/io_service.hpp | 1
   branches/release/boost/asio/ip/basic_resolver.hpp | 13
   branches/release/boost/asio/posix/basic_descriptor.hpp | 14
   branches/release/boost/asio/read.hpp | 110 ++--
   branches/release/boost/asio/read_at.hpp | 78 +-
   branches/release/boost/asio/ssl/detail/openssl_operation.hpp | 4
   branches/release/boost/asio/ssl/detail/openssl_stream_service.hpp | 8
   branches/release/boost/asio/ssl/stream.hpp | 13
   branches/release/boost/asio/version.hpp | 2
   branches/release/boost/asio/windows/basic_handle.hpp | 14
   branches/release/boost/asio/write.hpp | 116 ++--
   branches/release/boost/asio/write_at.hpp | 70 +-
   branches/release/libs/asio/doc/Jamfile.v2 | 2
   branches/release/libs/asio/doc/doxy2qbk.pl | 2
   branches/release/libs/asio/doc/examples.qbk | 8
   branches/release/libs/asio/doc/quickref.xml | 1
   branches/release/libs/asio/doc/reference.qbk | 1018 ++++++++++++++++++++++++++++++++-------
   branches/release/libs/asio/doc/using.qbk | 7
   branches/release/libs/asio/example/nonblocking/third_party_lib.cpp | 4
   branches/release/libs/asio/test/Jamfile | 3
   branches/release/libs/asio/test/Jamfile.v2 | 6
   branches/release/libs/asio/test/ip/tcp.cpp | 5
   branches/release/libs/asio/test/ip/udp.cpp | 5
   branches/release/libs/asio/test/posix/stream_descriptor.cpp | 5
   branches/release/libs/asio/test/read.cpp | 189 +++++++
   branches/release/libs/asio/test/read_until.cpp | 2
   branches/release/libs/asio/test/serial_port.cpp | 6
   branches/release/libs/asio/test/serial_port_base.cpp | 2
   branches/release/libs/asio/test/ssl/stream.cpp | 5
   branches/release/libs/asio/test/windows/random_access_handle.cpp | 5
   branches/release/libs/asio/test/windows/stream_handle.cpp | 5
   branches/release/libs/asio/test/write.cpp | 171 ++++++
   54 files changed, 1938 insertions(+), 563 deletions(-)

Modified: branches/release/boost/asio.hpp
==============================================================================
--- branches/release/boost/asio.hpp (original)
+++ branches/release/boost/asio.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -89,6 +89,7 @@
 #include <boost/asio/windows/basic_handle.hpp>
 #include <boost/asio/windows/basic_random_access_handle.hpp>
 #include <boost/asio/windows/basic_stream_handle.hpp>
+#include <boost/asio/windows/overlapped_ptr.hpp>
 #include <boost/asio/windows/random_access_handle.hpp>
 #include <boost/asio/windows/random_access_handle_service.hpp>
 #include <boost/asio/windows/stream_handle.hpp>

Modified: branches/release/boost/asio/basic_serial_port.hpp
==============================================================================
--- branches/release/boost/asio/basic_serial_port.hpp (original)
+++ branches/release/boost/asio/basic_serial_port.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -143,6 +143,20 @@
     return *this;
   }
 
+ /// Get a const reference to the lowest layer.
+ /**
+ * This function returns a const reference to the lowest layer in a stack of
+ * layers. Since a basic_serial_port cannot contain any further layers, it
+ * simply returns a reference to itself.
+ *
+ * @return A const reference to the lowest layer in the stack of layers.
+ * Ownership is not transferred to the caller.
+ */
+ const lowest_layer_type& lowest_layer() const
+ {
+ return *this;
+ }
+
   /// Open the serial port using the specified device name.
   /**
    * This function opens the serial port for the specified device name.

Modified: branches/release/boost/asio/basic_socket.hpp
==============================================================================
--- branches/release/boost/asio/basic_socket.hpp (original)
+++ branches/release/boost/asio/basic_socket.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -150,6 +150,20 @@
     return *this;
   }
 
+ /// Get a const reference to the lowest layer.
+ /**
+ * This function returns a const reference to the lowest layer in a stack of
+ * layers. Since a basic_socket cannot contain any further layers, it simply
+ * returns a reference to itself.
+ *
+ * @return A const reference to the lowest layer in the stack of layers.
+ * Ownership is not transferred to the caller.
+ */
+ const lowest_layer_type& lowest_layer() const
+ {
+ return *this;
+ }
+
   /// Open the socket using the specified protocol.
   /**
    * This function opens the socket so that it will use the specified protocol.

Modified: branches/release/boost/asio/buffered_read_stream.hpp
==============================================================================
--- branches/release/boost/asio/buffered_read_stream.hpp (original)
+++ branches/release/boost/asio/buffered_read_stream.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -94,6 +94,12 @@
     return next_layer_.lowest_layer();
   }
 
+ /// Get a const reference to the lowest layer.
+ const lowest_layer_type& lowest_layer() const
+ {
+ return next_layer_.lowest_layer();
+ }
+
   /// (Deprecated: use get_io_service().) Get the io_service associated with
   /// the object.
   boost::asio::io_service& io_service()

Modified: branches/release/boost/asio/buffered_stream.hpp
==============================================================================
--- branches/release/boost/asio/buffered_stream.hpp (original)
+++ branches/release/boost/asio/buffered_stream.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -84,6 +84,12 @@
     return stream_impl_.lowest_layer();
   }
 
+ /// Get a const reference to the lowest layer.
+ const lowest_layer_type& lowest_layer() const
+ {
+ return stream_impl_.lowest_layer();
+ }
+
   /// (Deprecated: use get_io_service().) Get the io_service associated with
   /// the object.
   boost::asio::io_service& io_service()

Modified: branches/release/boost/asio/buffered_write_stream.hpp
==============================================================================
--- branches/release/boost/asio/buffered_write_stream.hpp (original)
+++ branches/release/boost/asio/buffered_write_stream.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -95,6 +95,12 @@
     return next_layer_.lowest_layer();
   }
 
+ /// Get a const reference to the lowest layer.
+ const lowest_layer_type& lowest_layer() const
+ {
+ return next_layer_.lowest_layer();
+ }
+
   /// (Deprecated: use get_io_service().) Get the io_service associated with
   /// the object.
   boost::asio::io_service& io_service()

Modified: branches/release/boost/asio/buffers_iterator.hpp
==============================================================================
--- branches/release/boost/asio/buffers_iterator.hpp (original)
+++ branches/release/boost/asio/buffers_iterator.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -21,6 +21,7 @@
 #include <cstddef>
 #include <boost/assert.hpp>
 #include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
 #include <boost/iterator/iterator_facade.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 #include <boost/type_traits/add_const.hpp>
@@ -101,6 +102,9 @@
 
   /// Construct an iterator representing the beginning of the buffers' data.
   static buffers_iterator begin(const BufferSequence& buffers)
+#if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3)
+ __attribute__ ((noinline))
+#endif
   {
     buffers_iterator new_iter;
     new_iter.begin_ = buffers.begin();
@@ -118,6 +122,9 @@
 
   /// Construct an iterator representing the end of the buffers' data.
   static buffers_iterator end(const BufferSequence& buffers)
+#if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3)
+ __attribute__ ((noinline))
+#endif
   {
     buffers_iterator new_iter;
     new_iter.begin_ = buffers.begin();

Modified: branches/release/boost/asio/completion_condition.hpp
==============================================================================
--- branches/release/boost/asio/completion_condition.hpp (original)
+++ branches/release/boost/asio/completion_condition.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -27,22 +27,40 @@
 
 namespace detail {
 
+// The default maximum number of bytes to transfer in a single operation.
+enum { default_max_transfer_size = 65536 };
+
+// Adapt result of old-style completion conditions (which had a bool result
+// where true indicated that the operation was complete).
+inline std::size_t adapt_completion_condition_result(bool result)
+{
+ return result ? 0 : default_max_transfer_size;
+}
+
+// Adapt result of current completion conditions (which have a size_t result
+// where 0 means the operation is complete, and otherwise the result is the
+// maximum number of bytes to transfer on the next underlying operation).
+inline std::size_t adapt_completion_condition_result(std::size_t result)
+{
+ return result;
+}
+
 class transfer_all_t
 {
 public:
- typedef bool result_type;
+ typedef std::size_t result_type;
 
   template <typename Error>
- bool operator()(const Error& err, std::size_t)
+ std::size_t operator()(const Error& err, std::size_t)
   {
- return !!err;
+ return !!err ? 0 : default_max_transfer_size;
   }
 };
 
 class transfer_at_least_t
 {
 public:
- typedef bool result_type;
+ typedef std::size_t result_type;
 
   explicit transfer_at_least_t(std::size_t minimum)
     : minimum_(minimum)
@@ -50,9 +68,10 @@
   }
 
   template <typename Error>
- bool operator()(const Error& err, std::size_t bytes_transferred)
+ std::size_t operator()(const Error& err, std::size_t bytes_transferred)
   {
- return !!err || bytes_transferred >= minimum_;
+ return (!!err || bytes_transferred >= minimum_)
+ ? 0 : default_max_transfer_size;
   }
 
 private:

Modified: branches/release/boost/asio/detail/consuming_buffers.hpp
==============================================================================
--- branches/release/boost/asio/detail/consuming_buffers.hpp (original)
+++ branches/release/boost/asio/detail/consuming_buffers.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -20,11 +20,13 @@
 #include <boost/asio/detail/push_options.hpp>
 #include <algorithm>
 #include <cstddef>
+#include <limits>
 #include <boost/config.hpp>
 #include <boost/iterator/iterator_facade.hpp>
 #include <boost/asio/detail/pop_options.hpp>
 
 #include <boost/asio/buffer.hpp>
+#include <boost/asio/completion_condition.hpp>
 
 namespace boost {
 namespace asio {
@@ -47,33 +49,33 @@
   // Construct with a buffer for the first entry and an iterator
   // range for the remaining entries.
   consuming_buffers_iterator(bool at_end, const Buffer& first,
- Buffer_Iterator begin_remainder, Buffer_Iterator end_remainder)
- : at_end_(at_end),
+ Buffer_Iterator begin_remainder, Buffer_Iterator end_remainder,
+ std::size_t max_size)
+ : at_end_(max_size > 0 ? at_end : true),
       first_(buffer(first, max_size)),
       begin_remainder_(begin_remainder),
       end_remainder_(end_remainder),
- offset_(0)
+ offset_(0),
+ max_size_(max_size)
   {
   }
 
 private:
   friend class boost::iterator_core_access;
 
- enum { max_size = 65536 };
-
   void increment()
   {
     if (!at_end_)
     {
       if (begin_remainder_ == end_remainder_
- || offset_ + buffer_size(first_) >= max_size)
+ || offset_ + buffer_size(first_) >= max_size_)
       {
         at_end_ = true;
       }
       else
       {
         offset_ += buffer_size(first_);
- first_ = buffer(*begin_remainder_++, max_size - offset_);
+ first_ = buffer(*begin_remainder_++, max_size_ - offset_);
       }
     }
   }
@@ -100,6 +102,7 @@
   Buffer_Iterator begin_remainder_;
   Buffer_Iterator end_remainder_;
   std::size_t offset_;
+ std::size_t max_size_;
 };
 
 // A proxy for a sub-range in a list of buffers.
@@ -119,7 +122,8 @@
     : buffers_(buffers),
       at_end_(buffers_.begin() == buffers_.end()),
       first_(*buffers_.begin()),
- begin_remainder_(buffers_.begin())
+ begin_remainder_(buffers_.begin()),
+ max_size_((std::numeric_limits<std::size_t>::max)())
   {
     if (!at_end_)
       ++begin_remainder_;
@@ -130,7 +134,8 @@
     : buffers_(other.buffers_),
       at_end_(other.at_end_),
       first_(other.first_),
- begin_remainder_(buffers_.begin())
+ begin_remainder_(buffers_.begin()),
+ max_size_(other.max_size_)
   {
     typename Buffers::const_iterator first = other.buffers_.begin();
     typename Buffers::const_iterator second = other.begin_remainder_;
@@ -147,13 +152,15 @@
     typename Buffers::const_iterator first = other.buffers_.begin();
     typename Buffers::const_iterator second = other.begin_remainder_;
     std::advance(begin_remainder_, std::distance(first, second));
+ max_size_ = other.max_size_;
     return *this;
   }
 
   // Get a forward-only iterator to the first element.
   const_iterator begin() const
   {
- return const_iterator(at_end_, first_, begin_remainder_, buffers_.end());
+ return const_iterator(at_end_, first_,
+ begin_remainder_, buffers_.end(), max_size_);
   }
 
   // Get a forward-only iterator for one past the last element.
@@ -162,6 +169,12 @@
     return const_iterator();
   }
 
+ // Set the maximum size for a single transfer.
+ void set_max_size(std::size_t max_size)
+ {
+ max_size_ = max_size;
+ }
+
   // Consume the specified number of bytes from the buffers.
   void consume(std::size_t size)
   {
@@ -198,6 +211,7 @@
   bool at_end_;
   Buffer first_;
   typename Buffers::const_iterator begin_remainder_;
+ std::size_t max_size_;
 };
 
 // Specialisation for null_buffers to ensure that the null_buffers type is
@@ -212,6 +226,11 @@
     // No-op.
   }
 
+ void set_max_size(std::size_t)
+ {
+ // No-op.
+ }
+
   void consume(std::size_t)
   {
     // No-op.

Modified: branches/release/boost/asio/detail/descriptor_ops.hpp
==============================================================================
--- branches/release/boost/asio/detail/descriptor_ops.hpp (original)
+++ branches/release/boost/asio/detail/descriptor_ops.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -59,17 +59,28 @@
   return error_wrapper(::close(d), ec);
 }
 
+inline void init_buf_iov_base(void*& base, void* addr)
+{
+ base = addr;
+}
+
+template <typename T>
+inline void init_buf_iov_base(T& base, void* addr)
+{
+ base = static_cast<T>(addr);
+}
+
 typedef iovec buf;
 
 inline void init_buf(buf& b, void* data, size_t size)
 {
- b.iov_base = data;
+ init_buf_iov_base(b.iov_base, data);
   b.iov_len = size;
 }
 
 inline void init_buf(buf& b, const void* data, size_t size)
 {
- b.iov_base = const_cast<void*>(data);
+ init_buf_iov_base(b.iov_base, const_cast<void*>(data));
   b.iov_len = size;
 }
 

Modified: branches/release/boost/asio/detail/reactive_socket_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_socket_service.hpp (original)
+++ branches/release/boost/asio/detail/reactive_socket_service.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -74,10 +74,21 @@
 
     enum
     {
- user_set_non_blocking = 1, // The user wants a non-blocking socket.
- internal_non_blocking = 2, // The socket has been set non-blocking.
- enable_connection_aborted = 4, // User wants connection_aborted errors.
- user_set_linger = 8 // The user set the linger option.
+ // The user wants a non-blocking socket.
+ user_set_non_blocking = 1,
+
+ // The implementation wants a non-blocking socket (in order to be able to
+ // perform asynchronous read and write operations).
+ internal_non_blocking = 2,
+
+ // Helper "flag" used to determine whether the socket is non-blocking.
+ non_blocking = user_set_non_blocking | internal_non_blocking,
+
+ // User wants connection_aborted errors, which are disabled by default.
+ enable_connection_aborted = 4,
+
+ // The user set the linger option. Needs to be checked when closing.
+ user_set_linger = 8
     };
 
     // Flags indicating the current state of the socket.
@@ -120,12 +131,12 @@
     {
       reactor_.close_descriptor(impl.socket_, impl.reactor_data_);
 
- if (impl.flags_ & implementation_type::internal_non_blocking)
+ if (impl.flags_ & implementation_type::non_blocking)
       {
         ioctl_arg_type non_blocking = 0;
         boost::system::error_code ignored_ec;
         socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ignored_ec);
- impl.flags_ &= ~implementation_type::internal_non_blocking;
+ impl.flags_ &= ~implementation_type::non_blocking;
       }
 
       if (impl.flags_ & implementation_type::user_set_linger)
@@ -214,12 +225,12 @@
     {
       reactor_.close_descriptor(impl.socket_, impl.reactor_data_);
 
- if (impl.flags_ & implementation_type::internal_non_blocking)
+ if (impl.flags_ & implementation_type::non_blocking)
       {
         ioctl_arg_type non_blocking = 0;
         boost::system::error_code ignored_ec;
         socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ignored_ec);
- impl.flags_ &= ~implementation_type::internal_non_blocking;
+ impl.flags_ &= ~implementation_type::non_blocking;
       }
 
       if (socket_ops::close(impl.socket_, ec) == socket_error_retval)
@@ -433,11 +444,35 @@
 
     if (command.name() == static_cast<int>(FIONBIO))
     {
+ // Flags are manipulated in a temporary variable so that the socket
+ // implementation is not updated unless the ioctl operation succeeds.
+ unsigned char new_flags = impl.flags_;
       if (command.get())
- impl.flags_ |= implementation_type::user_set_non_blocking;
+ new_flags |= implementation_type::user_set_non_blocking;
       else
- impl.flags_ &= ~implementation_type::user_set_non_blocking;
- ec = boost::system::error_code();
+ new_flags &= ~implementation_type::user_set_non_blocking;
+
+ // Perform ioctl on socket if the non-blocking state has changed.
+ if (!(impl.flags_ & implementation_type::non_blocking)
+ && (new_flags & implementation_type::non_blocking))
+ {
+ ioctl_arg_type non_blocking = 1;
+ socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec);
+ }
+ else if ((impl.flags_ & implementation_type::non_blocking)
+ && !(new_flags & implementation_type::non_blocking))
+ {
+ ioctl_arg_type non_blocking = 0;
+ socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec);
+ }
+ else
+ {
+ ec = boost::system::error_code();
+ }
+
+ // Update socket implementation's flags only if successful.
+ if (!ec)
+ impl.flags_ = new_flags;
     }
     else
     {
@@ -530,18 +565,6 @@
       return 0;
     }
 
- // Make socket non-blocking if user wants non-blocking.
- if (impl.flags_ & implementation_type::user_set_non_blocking)
- {
- if (!(impl.flags_ & implementation_type::internal_non_blocking))
- {
- ioctl_arg_type non_blocking = 1;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
- return 0;
- impl.flags_ |= implementation_type::internal_non_blocking;
- }
- }
-
     // Send the data.
     for (;;)
     {
@@ -684,12 +707,15 @@
       // Make socket non-blocking.
       if (!(impl.flags_ & implementation_type::internal_non_blocking))
       {
- ioctl_arg_type non_blocking = 1;
- boost::system::error_code ec;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ if (!(impl.flags_ & implementation_type::non_blocking))
         {
- this->get_io_service().post(bind_handler(handler, ec, 0));
- return;
+ ioctl_arg_type non_blocking = 1;
+ boost::system::error_code ec;
+ if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ {
+ this->get_io_service().post(bind_handler(handler, ec, 0));
+ return;
+ }
         }
         impl.flags_ |= implementation_type::internal_non_blocking;
       }
@@ -773,18 +799,6 @@
           boost::asio::buffer_size(buffer));
     }
 
- // Make socket non-blocking if user wants non-blocking.
- if (impl.flags_ & implementation_type::user_set_non_blocking)
- {
- if (!(impl.flags_ & implementation_type::internal_non_blocking))
- {
- ioctl_arg_type non_blocking = 1;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
- return 0;
- impl.flags_ |= implementation_type::internal_non_blocking;
- }
- }
-
     // Send the data.
     for (;;)
     {
@@ -912,12 +926,15 @@
       // Make socket non-blocking.
       if (!(impl.flags_ & implementation_type::internal_non_blocking))
       {
- ioctl_arg_type non_blocking = 1;
- boost::system::error_code ec;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ if (!(impl.flags_ & implementation_type::non_blocking))
         {
- this->get_io_service().post(bind_handler(handler, ec, 0));
- return;
+ ioctl_arg_type non_blocking = 1;
+ boost::system::error_code ec;
+ if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ {
+ this->get_io_service().post(bind_handler(handler, ec, 0));
+ return;
+ }
         }
         impl.flags_ |= implementation_type::internal_non_blocking;
       }
@@ -981,18 +998,6 @@
       return 0;
     }
 
- // Make socket non-blocking if user wants non-blocking.
- if (impl.flags_ & implementation_type::user_set_non_blocking)
- {
- if (!(impl.flags_ & implementation_type::internal_non_blocking))
- {
- ioctl_arg_type non_blocking = 1;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
- return 0;
- impl.flags_ |= implementation_type::internal_non_blocking;
- }
- }
-
     // Receive some data.
     for (;;)
     {
@@ -1148,12 +1153,15 @@
       // Make socket non-blocking.
       if (!(impl.flags_ & implementation_type::internal_non_blocking))
       {
- ioctl_arg_type non_blocking = 1;
- boost::system::error_code ec;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ if (!(impl.flags_ & implementation_type::non_blocking))
         {
- this->get_io_service().post(bind_handler(handler, ec, 0));
- return;
+ ioctl_arg_type non_blocking = 1;
+ boost::system::error_code ec;
+ if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ {
+ this->get_io_service().post(bind_handler(handler, ec, 0));
+ return;
+ }
         }
         impl.flags_ |= implementation_type::internal_non_blocking;
       }
@@ -1225,18 +1233,6 @@
           boost::asio::buffer_size(buffer));
     }
 
- // Make socket non-blocking if user wants non-blocking.
- if (impl.flags_ & implementation_type::user_set_non_blocking)
- {
- if (!(impl.flags_ & implementation_type::internal_non_blocking))
- {
- ioctl_arg_type non_blocking = 1;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
- return 0;
- impl.flags_ |= implementation_type::internal_non_blocking;
- }
- }
-
     // Receive some data.
     for (;;)
     {
@@ -1385,12 +1381,15 @@
       // Make socket non-blocking.
       if (!(impl.flags_ & implementation_type::internal_non_blocking))
       {
- ioctl_arg_type non_blocking = 1;
- boost::system::error_code ec;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ if (!(impl.flags_ & implementation_type::non_blocking))
         {
- this->get_io_service().post(bind_handler(handler, ec, 0));
- return;
+ ioctl_arg_type non_blocking = 1;
+ boost::system::error_code ec;
+ if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ {
+ this->get_io_service().post(bind_handler(handler, ec, 0));
+ return;
+ }
         }
         impl.flags_ |= implementation_type::internal_non_blocking;
       }
@@ -1450,18 +1449,6 @@
       return ec;
     }
 
- // Make socket non-blocking if user wants non-blocking.
- if (impl.flags_ & implementation_type::user_set_non_blocking)
- {
- if (!(impl.flags_ & implementation_type::internal_non_blocking))
- {
- ioctl_arg_type non_blocking = 1;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
- return ec;
- impl.flags_ |= implementation_type::internal_non_blocking;
- }
- }
-
     // Accept a socket.
     for (;;)
     {
@@ -1623,12 +1610,15 @@
       // Make socket non-blocking.
       if (!(impl.flags_ & implementation_type::internal_non_blocking))
       {
- ioctl_arg_type non_blocking = 1;
- boost::system::error_code ec;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ if (!(impl.flags_ & implementation_type::non_blocking))
         {
- this->get_io_service().post(bind_handler(handler, ec));
- return;
+ ioctl_arg_type non_blocking = 1;
+ boost::system::error_code ec;
+ if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ {
+ this->get_io_service().post(bind_handler(handler, ec));
+ return;
+ }
         }
         impl.flags_ |= implementation_type::internal_non_blocking;
       }
@@ -1652,18 +1642,30 @@
       return ec;
     }
 
- if (impl.flags_ & implementation_type::internal_non_blocking)
- {
- // Mark the socket as blocking while we perform the connect.
- ioctl_arg_type non_blocking = 0;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
- return ec;
- impl.flags_ &= ~implementation_type::internal_non_blocking;
- }
-
     // Perform the connect operation.
     socket_ops::connect(impl.socket_,
         peer_endpoint.data(), peer_endpoint.size(), ec);
+ if (ec != boost::asio::error::in_progress
+ && ec != boost::asio::error::would_block)
+ {
+ // The connect operation finished immediately.
+ return ec;
+ }
+
+ // Wait for socket to become ready.
+ if (socket_ops::poll_connect(impl.socket_, ec) < 0)
+ return ec;
+
+ // Get the error code from the connect operation.
+ int connect_error = 0;
+ size_t connect_error_len = sizeof(connect_error);
+ if (socket_ops::getsockopt(impl.socket_, SOL_SOCKET, SO_ERROR,
+ &connect_error, &connect_error_len, ec) == socket_error_retval)
+ return ec;
+
+ // Return the result of the connect operation.
+ ec = boost::system::error_code(connect_error,
+ boost::asio::error::get_system_category());
     return ec;
   }
 
@@ -1731,12 +1733,15 @@
     // Make socket non-blocking.
     if (!(impl.flags_ & implementation_type::internal_non_blocking))
     {
- ioctl_arg_type non_blocking = 1;
- boost::system::error_code ec;
- if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ if (!(impl.flags_ & implementation_type::non_blocking))
       {
- this->get_io_service().post(bind_handler(handler, ec));
- return;
+ ioctl_arg_type non_blocking = 1;
+ boost::system::error_code ec;
+ if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
+ {
+ this->get_io_service().post(bind_handler(handler, ec));
+ return;
+ }
       }
       impl.flags_ |= implementation_type::internal_non_blocking;
     }

Modified: branches/release/boost/asio/detail/select_interrupter.hpp
==============================================================================
--- branches/release/boost/asio/detail/select_interrupter.hpp (original)
+++ branches/release/boost/asio/detail/select_interrupter.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -21,6 +21,7 @@
 #include <boost/config.hpp>
 #include <boost/asio/detail/pop_options.hpp>
 
+#include <boost/asio/detail/eventfd_select_interrupter.hpp>
 #include <boost/asio/detail/pipe_select_interrupter.hpp>
 #include <boost/asio/detail/socket_select_interrupter.hpp>
 
@@ -30,6 +31,8 @@
 
 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
 typedef socket_select_interrupter select_interrupter;
+#elif defined(BOOST_ASIO_HAS_EVENTFD)
+typedef eventfd_select_interrupter select_interrupter;
 #else
 typedef pipe_select_interrupter select_interrupter;
 #endif

Modified: branches/release/boost/asio/detail/socket_ops.hpp
==============================================================================
--- branches/release/boost/asio/detail/socket_ops.hpp (original)
+++ branches/release/boost/asio/detail/socket_ops.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -203,6 +203,17 @@
   return result;
 }
 
+inline void init_buf_iov_base(void*& base, void* addr)
+{
+ base = addr;
+}
+
+template <typename T>
+inline void init_buf_iov_base(T& base, void* addr)
+{
+ base = static_cast<T>(addr);
+}
+
 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
 typedef WSABUF buf;
 #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
@@ -215,7 +226,7 @@
   b.buf = static_cast<char*>(data);
   b.len = static_cast<u_long>(size);
 #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
- b.iov_base = data;
+ init_buf_iov_base(b.iov_base, data);
   b.iov_len = size;
 #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
 }
@@ -226,7 +237,7 @@
   b.buf = static_cast<char*>(const_cast<void*>(data));
   b.len = static_cast<u_long>(size);
 #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
- b.iov_base = const_cast<void*>(data);
+ init_buf_iov_base(b.iov_base, const_cast<void*>(data));
   b.iov_len = size;
 #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
 }
@@ -702,6 +713,32 @@
 #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
 }
 
+inline int poll_connect(socket_type s, boost::system::error_code& ec)
+{
+#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ FD_SET write_fds;
+ FD_ZERO(&write_fds);
+ FD_SET(s, &write_fds);
+ FD_SET except_fds;
+ FD_ZERO(&except_fds);
+ FD_SET(s, &except_fds);
+ clear_error(ec);
+ int result = error_wrapper(::select(s, 0, &write_fds, &except_fds, 0), ec);
+# if defined(UNDER_CE)
+ if (result >= 0)
+ clear_error(ec);
+# endif
+ return result;
+#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ pollfd fds;
+ fds.fd = s;
+ fds.events = POLLOUT;
+ fds.revents = 0;
+ clear_error(ec);
+ return error_wrapper(::poll(&fds, 1, -1), ec);
+#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+}
+
 inline const char* inet_ntop(int af, const void* src, char* dest, size_t length,
     unsigned long scope_id, boost::system::error_code& ec)
 {

Modified: branches/release/boost/asio/detail/win_iocp_io_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_io_service.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_io_service.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -531,7 +531,7 @@
           // Wake up next thread that is blocked on GetQueuedCompletionStatus.
           if (!::PostQueuedCompletionStatus(iocp_.handle, 0, 0, 0))
           {
- DWORD last_error = ::GetLastError();
+ last_error = ::GetLastError();
             ec = boost::system::error_code(last_error,
                 boost::asio::error::get_system_category());
             return 0;

Modified: branches/release/boost/asio/detail/win_iocp_io_service_fwd.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_io_service_fwd.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_io_service_fwd.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -37,6 +37,7 @@
 namespace detail {
 
 class win_iocp_io_service;
+class win_iocp_overlapped_ptr;
 
 } // namespace detail
 } // namespace asio

Copied: branches/release/boost/asio/detail/win_iocp_overlapped_ptr.hpp (from r48495, /trunk/boost/asio/detail/win_iocp_overlapped_ptr.hpp)
==============================================================================
--- /trunk/boost/asio/detail/win_iocp_overlapped_ptr.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_overlapped_ptr.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -147,7 +147,7 @@
     overlapped_operation(const overlapped_operation&);
     void operator=(const overlapped_operation&);
     
- static void do_completion_impl(operation* op,
+ static void do_completion_impl(win_iocp_io_service::operation* op,
         DWORD last_error, size_t bytes_transferred)
     {
       // Take ownership of the operation object.
@@ -172,7 +172,7 @@
           bind_handler(handler, ec, bytes_transferred), &handler);
     }
 
- static void destroy_impl(operation* op)
+ static void destroy_impl(win_iocp_io_service::operation* op)
     {
       // Take ownership of the operation object.
       typedef overlapped_operation<Handler> op_type;

Modified: branches/release/boost/asio/detail/win_thread.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_thread.hpp (original)
+++ branches/release/boost/asio/detail/win_thread.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -80,6 +80,11 @@
         boost::throw_exception(e);
       }
     }
+ else
+ {
+ arg->entry_event_ = 0;
+ arg->exit_event_ = 0;
+ }
 
     unsigned int thread_id = 0;
     thread_ = reinterpret_cast<HANDLE>(::_beginthreadex(0, 0,

Modified: branches/release/boost/asio/impl/read.ipp
==============================================================================
--- branches/release/boost/asio/impl/read.ipp (original)
+++ branches/release/boost/asio/impl/read.ipp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -38,18 +38,20 @@
 std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
     CompletionCondition completion_condition, boost::system::error_code& ec)
 {
+ ec = boost::system::error_code();
   boost::asio::detail::consuming_buffers<
     mutable_buffer, MutableBufferSequence> tmp(buffers);
   std::size_t total_transferred = 0;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
   while (tmp.begin() != tmp.end())
   {
     std::size_t bytes_transferred = s.read_some(tmp, ec);
     tmp.consume(bytes_transferred);
     total_transferred += bytes_transferred;
- if (completion_condition(ec, total_transferred))
- return total_transferred;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
   }
- ec = boost::system::error_code();
   return total_transferred;
 }
 
@@ -79,18 +81,23 @@
     boost::asio::basic_streambuf<Allocator>& b,
     CompletionCondition completion_condition, boost::system::error_code& ec)
 {
+ ec = boost::system::error_code();
   std::size_t total_transferred = 0;
- for (;;)
+ std::size_t max_size = detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred));
+ std::size_t bytes_available = std::min<std::size_t>(512,
+ std::min<std::size_t>(max_size, b.max_size() - b.size()));
+ while (bytes_available > 0)
   {
- std::size_t bytes_available =
- std::min<std::size_t>(512, b.max_size() - b.size());
     std::size_t bytes_transferred = s.read_some(b.prepare(bytes_available), ec);
     b.commit(bytes_transferred);
     total_transferred += bytes_transferred;
- if (b.size() == b.max_size()
- || completion_condition(ec, total_transferred))
- return total_transferred;
+ max_size = detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred));
+ bytes_available = std::min<std::size_t>(512,
+ std::min<std::size_t>(max_size, b.max_size() - b.size()));
   }
+ return total_transferred;
 }
 
 template <typename SyncReadStream, typename Allocator>
@@ -140,8 +147,9 @@
     {
       total_transferred_ += bytes_transferred;
       buffers_.consume(bytes_transferred);
- if (completion_condition_(ec, total_transferred_)
- || buffers_.begin() == buffers_.end())
+ buffers_.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition_(ec, total_transferred_)));
+ if (buffers_.begin() == buffers_.end())
       {
         handler_(ec, total_transferred_);
       }
@@ -198,6 +206,18 @@
 {
   boost::asio::detail::consuming_buffers<
     mutable_buffer, MutableBufferSequence> tmp(buffers);
+
+ boost::system::error_code ec;
+ std::size_t total_transferred = 0;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
+ if (tmp.begin() == tmp.end())
+ {
+ s.get_io_service().post(detail::bind_handler(
+ handler, ec, total_transferred));
+ return;
+ }
+
   s.async_read_some(tmp,
       detail::read_handler<AsyncReadStream, MutableBufferSequence,
         CompletionCondition, ReadHandler>(
@@ -235,15 +255,17 @@
     {
       total_transferred_ += bytes_transferred;
       streambuf_.commit(bytes_transferred);
- if (streambuf_.size() == streambuf_.max_size()
- || completion_condition_(ec, total_transferred_))
+ std::size_t max_size = detail::adapt_completion_condition_result(
+ completion_condition_(ec, total_transferred_));
+ std::size_t bytes_available = std::min<std::size_t>(512,
+ std::min<std::size_t>(max_size,
+ streambuf_.max_size() - streambuf_.size()));
+ if (bytes_available == 0)
       {
         handler_(ec, total_transferred_);
       }
       else
       {
- std::size_t bytes_available =
- std::min<std::size_t>(512, streambuf_.max_size() - streambuf_.size());
         stream_.async_read_some(streambuf_.prepare(bytes_available), *this);
       }
     }
@@ -293,8 +315,19 @@
     boost::asio::basic_streambuf<Allocator>& b,
     CompletionCondition completion_condition, ReadHandler handler)
 {
- std::size_t bytes_available =
- std::min<std::size_t>(512, b.max_size() - b.size());
+ boost::system::error_code ec;
+ std::size_t total_transferred = 0;
+ std::size_t max_size = detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred));
+ std::size_t bytes_available = std::min<std::size_t>(512,
+ std::min<std::size_t>(max_size, b.max_size() - b.size()));
+ if (bytes_available == 0)
+ {
+ s.get_io_service().post(detail::bind_handler(
+ handler, ec, total_transferred));
+ return;
+ }
+
   s.async_read_some(b.prepare(bytes_available),
       detail::read_streambuf_handler<AsyncReadStream, Allocator,
         CompletionCondition, ReadHandler>(

Modified: branches/release/boost/asio/impl/read_at.ipp
==============================================================================
--- branches/release/boost/asio/impl/read_at.ipp (original)
+++ branches/release/boost/asio/impl/read_at.ipp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -39,19 +39,21 @@
     boost::uint64_t offset, const MutableBufferSequence& buffers,
     CompletionCondition completion_condition, boost::system::error_code& ec)
 {
+ ec = boost::system::error_code();
   boost::asio::detail::consuming_buffers<
     mutable_buffer, MutableBufferSequence> tmp(buffers);
   std::size_t total_transferred = 0;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
   while (tmp.begin() != tmp.end())
   {
     std::size_t bytes_transferred = d.read_some_at(
         offset + total_transferred, tmp, ec);
     tmp.consume(bytes_transferred);
     total_transferred += bytes_transferred;
- if (completion_condition(ec, total_transferred))
- return total_transferred;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
   }
- ec = boost::system::error_code();
   return total_transferred;
 }
 
@@ -152,8 +154,9 @@
     {
       total_transferred_ += bytes_transferred;
       buffers_.consume(bytes_transferred);
- if (completion_condition_(ec, total_transferred_)
- || buffers_.begin() == buffers_.end())
+ buffers_.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition_(ec, total_transferred_)));
+ if (buffers_.begin() == buffers_.end())
       {
         handler_(ec, total_transferred_);
       }
@@ -215,6 +218,18 @@
 {
   boost::asio::detail::consuming_buffers<
     mutable_buffer, MutableBufferSequence> tmp(buffers);
+
+ boost::system::error_code ec;
+ std::size_t total_transferred = 0;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
+ if (tmp.begin() == tmp.end())
+ {
+ d.get_io_service().post(detail::bind_handler(
+ handler, ec, total_transferred));
+ return;
+ }
+
   d.async_read_some_at(offset, tmp,
       detail::read_at_handler<AsyncRandomAccessReadDevice,
         MutableBufferSequence, CompletionCondition, ReadHandler>(
@@ -254,15 +269,17 @@
     {
       total_transferred_ += bytes_transferred;
       streambuf_.commit(bytes_transferred);
- if (streambuf_.size() == streambuf_.max_size()
- || completion_condition_(ec, total_transferred_))
+ std::size_t max_size = detail::adapt_completion_condition_result(
+ completion_condition_(ec, total_transferred_));
+ std::size_t bytes_available = std::min<std::size_t>(512,
+ std::min<std::size_t>(max_size,
+ streambuf_.max_size() - streambuf_.size()));
+ if (bytes_available == 0)
       {
         handler_(ec, total_transferred_);
       }
       else
       {
- std::size_t bytes_available =
- std::min<std::size_t>(512, streambuf_.max_size() - streambuf_.size());
         stream_.async_read_some_at(offset_ + total_transferred_,
             streambuf_.prepare(bytes_available), *this);
       }
@@ -314,8 +331,19 @@
     boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
     CompletionCondition completion_condition, ReadHandler handler)
 {
- std::size_t bytes_available =
- std::min<std::size_t>(512, b.max_size() - b.size());
+ boost::system::error_code ec;
+ std::size_t total_transferred = 0;
+ std::size_t max_size = detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred));
+ std::size_t bytes_available = std::min<std::size_t>(512,
+ std::min<std::size_t>(max_size, b.max_size() - b.size()));
+ if (bytes_available == 0)
+ {
+ d.get_io_service().post(detail::bind_handler(
+ handler, ec, total_transferred));
+ return;
+ }
+
   d.async_read_some_at(offset, b.prepare(bytes_available),
       detail::read_at_streambuf_handler<AsyncRandomAccessReadDevice, Allocator,
         CompletionCondition, ReadHandler>(

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-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -449,7 +449,7 @@
     // Found a match. We're done.
     boost::system::error_code ec;
     std::size_t bytes = iter - begin + 1;
- s.io_service().post(detail::bind_handler(handler, ec, bytes));
+ s.get_io_service().post(detail::bind_handler(handler, ec, bytes));
     return;
   }
 
@@ -457,7 +457,7 @@
   if (b.size() == b.max_size())
   {
     boost::system::error_code ec(error::not_found);
- s.io_service().post(detail::bind_handler(handler, ec, 0));
+ s.get_io_service().post(detail::bind_handler(handler, ec, 0));
     return;
   }
 
@@ -538,8 +538,8 @@
       if (streambuf_.size() == streambuf_.max_size())
       {
         std::size_t bytes = 0;
- boost::system::error_code ec(error::not_found);
- handler_(ec, bytes);
+ boost::system::error_code ec2(error::not_found);
+ handler_(ec2, bytes);
         return;
       }
 
@@ -610,7 +610,7 @@
       // Full match. We're done.
       boost::system::error_code ec;
       std::size_t bytes = result.first - begin + delim.length();
- s.io_service().post(detail::bind_handler(handler, ec, bytes));
+ s.get_io_service().post(detail::bind_handler(handler, ec, bytes));
       return;
     }
     else
@@ -629,7 +629,7 @@
   if (b.size() == b.max_size())
   {
     boost::system::error_code ec(error::not_found);
- s.io_service().post(detail::bind_handler(handler, ec, 0));
+ s.get_io_service().post(detail::bind_handler(handler, ec, 0));
     return;
   }
 
@@ -783,7 +783,7 @@
       // Full match. We're done.
       boost::system::error_code ec;
       std::size_t bytes = match_results[0].second - begin;
- s.io_service().post(detail::bind_handler(handler, ec, bytes));
+ s.get_io_service().post(detail::bind_handler(handler, ec, bytes));
       return;
     }
     else
@@ -802,7 +802,7 @@
   if (b.size() == b.max_size())
   {
     boost::system::error_code ec(error::not_found);
- s.io_service().post(detail::bind_handler(handler, ec, 0));
+ s.get_io_service().post(detail::bind_handler(handler, ec, 0));
     return;
   }
 
@@ -958,7 +958,7 @@
       // Full match. We're done.
       boost::system::error_code ec;
       std::size_t bytes = result.first - begin;
- s.io_service().post(detail::bind_handler(handler, ec, bytes));
+ s.get_io_service().post(detail::bind_handler(handler, ec, bytes));
       return;
     }
     else
@@ -977,7 +977,7 @@
   if (b.size() == b.max_size())
   {
     boost::system::error_code ec(error::not_found);
- s.io_service().post(detail::bind_handler(handler, ec, 0));
+ s.get_io_service().post(detail::bind_handler(handler, ec, 0));
     return;
   }
 

Modified: branches/release/boost/asio/impl/write.ipp
==============================================================================
--- branches/release/boost/asio/impl/write.ipp (original)
+++ branches/release/boost/asio/impl/write.ipp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -33,18 +33,20 @@
 std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
     CompletionCondition completion_condition, boost::system::error_code& ec)
 {
+ ec = boost::system::error_code();
   boost::asio::detail::consuming_buffers<
     const_buffer, ConstBufferSequence> tmp(buffers);
   std::size_t total_transferred = 0;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
   while (tmp.begin() != tmp.end())
   {
     std::size_t bytes_transferred = s.write_some(tmp, ec);
     tmp.consume(bytes_transferred);
     total_transferred += bytes_transferred;
- if (completion_condition(ec, total_transferred))
- return total_transferred;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
   }
- ec = boost::system::error_code();
   return total_transferred;
 }
 
@@ -126,8 +128,9 @@
     {
       total_transferred_ += bytes_transferred;
       buffers_.consume(bytes_transferred);
- if (completion_condition_(ec, total_transferred_)
- || buffers_.begin() == buffers_.end())
+ buffers_.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition_(ec, total_transferred_)));
+ if (buffers_.begin() == buffers_.end())
       {
         handler_(ec, total_transferred_);
       }
@@ -184,6 +187,18 @@
 {
   boost::asio::detail::consuming_buffers<
     const_buffer, ConstBufferSequence> tmp(buffers);
+
+ boost::system::error_code ec;
+ std::size_t total_transferred = 0;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
+ if (tmp.begin() == tmp.end())
+ {
+ s.get_io_service().post(detail::bind_handler(
+ handler, ec, total_transferred));
+ return;
+ }
+
   s.async_write_some(tmp,
       detail::write_handler<AsyncWriteStream, ConstBufferSequence,
         CompletionCondition, WriteHandler>(

Modified: branches/release/boost/asio/impl/write_at.ipp
==============================================================================
--- branches/release/boost/asio/impl/write_at.ipp (original)
+++ branches/release/boost/asio/impl/write_at.ipp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -34,19 +34,21 @@
     boost::uint64_t offset, const ConstBufferSequence& buffers,
     CompletionCondition completion_condition, boost::system::error_code& ec)
 {
+ ec = boost::system::error_code();
   boost::asio::detail::consuming_buffers<
     const_buffer, ConstBufferSequence> tmp(buffers);
   std::size_t total_transferred = 0;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
   while (tmp.begin() != tmp.end())
   {
     std::size_t bytes_transferred = d.write_some_at(
         offset + total_transferred, tmp, ec);
     tmp.consume(bytes_transferred);
     total_transferred += bytes_transferred;
- if (completion_condition(ec, total_transferred))
- return total_transferred;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
   }
- ec = boost::system::error_code();
   return total_transferred;
 }
 
@@ -136,8 +138,9 @@
     {
       total_transferred_ += bytes_transferred;
       buffers_.consume(bytes_transferred);
- if (completion_condition_(ec, total_transferred_)
- || buffers_.begin() == buffers_.end())
+ buffers_.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition_(ec, total_transferred_)));
+ if (buffers_.begin() == buffers_.end())
       {
         handler_(ec, total_transferred_);
       }
@@ -197,6 +200,18 @@
 {
   boost::asio::detail::consuming_buffers<
     const_buffer, ConstBufferSequence> tmp(buffers);
+
+ boost::system::error_code ec;
+ std::size_t total_transferred = 0;
+ tmp.set_max_size(detail::adapt_completion_condition_result(
+ completion_condition(ec, total_transferred)));
+ if (tmp.begin() == tmp.end())
+ {
+ d.get_io_service().post(detail::bind_handler(
+ handler, ec, total_transferred));
+ return;
+ }
+
   d.async_write_some_at(offset, tmp,
       detail::write_at_handler<AsyncRandomAccessWriteDevice,
       ConstBufferSequence, CompletionCondition, WriteHandler>(

Modified: branches/release/boost/asio/io_service.hpp
==============================================================================
--- branches/release/boost/asio/io_service.hpp (original)
+++ branches/release/boost/asio/io_service.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -135,6 +135,7 @@
   // The type of the platform-specific implementation.
 #if defined(BOOST_ASIO_HAS_IOCP)
   typedef detail::win_iocp_io_service impl_type;
+ friend class detail::win_iocp_overlapped_ptr;
 #elif defined(BOOST_ASIO_HAS_EPOLL)
   typedef detail::task_io_service<detail::epoll_reactor<false> > impl_type;
 #elif defined(BOOST_ASIO_HAS_KQUEUE)

Modified: branches/release/boost/asio/ip/basic_resolver.hpp
==============================================================================
--- branches/release/boost/asio/ip/basic_resolver.hpp (original)
+++ branches/release/boost/asio/ip/basic_resolver.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -76,7 +76,7 @@
     return this->service.cancel(this->implementation);
   }
 
- /// Resolve a query to a list of entries.
+ /// Perform forward resolution of a query to a list of entries.
   /**
    * This function is used to resolve a query into a list of endpoint entries.
    *
@@ -100,7 +100,7 @@
     return i;
   }
 
- /// Resolve a query to a list of entries.
+ /// Perform forward resolution of a query to a list of entries.
   /**
    * This function is used to resolve a query into a list of endpoint entries.
    *
@@ -122,7 +122,7 @@
     return this->service.resolve(this->implementation, q, ec);
   }
 
- /// Asynchronously resolve a query to a list of entries.
+ /// Asynchronously perform forward resolution of a query to a list of entries.
   /**
    * This function is used to asynchronously resolve a query into a list of
    * endpoint entries.
@@ -154,7 +154,7 @@
     return this->service.async_resolve(this->implementation, q, handler);
   }
 
- /// Resolve an endpoint to a list of entries.
+ /// Perform reverse resolution of an endpoint to a list of entries.
   /**
    * This function is used to resolve an endpoint into a list of endpoint
    * entries.
@@ -180,7 +180,7 @@
     return i;
   }
 
- /// Resolve an endpoint to a list of entries.
+ /// Perform reverse resolution of an endpoint to a list of entries.
   /**
    * This function is used to resolve an endpoint into a list of endpoint
    * entries.
@@ -204,7 +204,8 @@
     return this->service.resolve(this->implementation, e, ec);
   }
 
- /// Asynchronously resolve an endpoint to a list of entries.
+ /// Asynchronously perform reverse resolution of an endpoint to a list of
+ /// entries.
   /**
    * This function is used to asynchronously resolve an endpoint into a list of
    * endpoint entries.

Modified: branches/release/boost/asio/posix/basic_descriptor.hpp
==============================================================================
--- branches/release/boost/asio/posix/basic_descriptor.hpp (original)
+++ branches/release/boost/asio/posix/basic_descriptor.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -100,6 +100,20 @@
     return *this;
   }
 
+ /// Get a const reference to the lowest layer.
+ /**
+ * This function returns a const reference to the lowest layer in a stack of
+ * layers. Since a basic_descriptor cannot contain any further layers, it
+ * simply returns a reference to itself.
+ *
+ * @return A const reference to the lowest layer in the stack of layers.
+ * Ownership is not transferred to the caller.
+ */
+ const lowest_layer_type& lowest_layer() const
+ {
+ return *this;
+ }
+
   /// Assign an existing native descriptor to the descriptor.
   /*
    * This function opens the descriptor to hold an existing native descriptor.

Modified: branches/release/boost/asio/read.hpp
==============================================================================
--- branches/release/boost/asio/read.hpp (original)
+++ branches/release/boost/asio/read.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -46,7 +46,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * read_some function.
  *
  * @param s The stream from which the data is to be read. The type must support
@@ -85,7 +85,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * read_some function.
  *
  * @param s The stream from which the data is to be read. The type must support
@@ -98,15 +98,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest read_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest read_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the stream's read_some function are required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the stream's read_some function.
  *
  * @returns The number of bytes transferred.
  *
@@ -135,7 +136,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * read_some function.
  *
  * @param s The stream from which the data is to be read. The type must support
@@ -148,15 +149,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest read_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest read_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the stream's read_some function are required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the stream's read_some function.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
@@ -175,7 +177,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * read_some function.
  *
  * @param s The stream from which the data is to be read. The type must support
@@ -202,7 +204,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * read_some function.
  *
  * @param s The stream from which the data is to be read. The type must support
@@ -213,15 +215,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest read_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest read_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the stream's read_some function are required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the stream's read_some function.
  *
  * @returns The number of bytes transferred.
  *
@@ -239,7 +242,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * read_some function.
  *
  * @param s The stream from which the data is to be read. The type must support
@@ -250,15 +253,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest read_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest read_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the stream's read_some function are required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the stream's read_some function.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
@@ -292,7 +296,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * async_read_some function.
  *
  * @param s The stream from which the data is to be read. The type must support
@@ -366,16 +370,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest read_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest async_read_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the stream's async_read_some function are
- * required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the stream's async_read_some function.
  *
  * @param handler The handler to be called when the read operation completes.
  * Copies will be made of the handler as required. The function signature of the
@@ -419,7 +423,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * async_read_some function.
  *
  * @param s The stream from which the data is to be read. The type must support
@@ -466,7 +470,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * async_read_some function.
  *
  * @param s The stream from which the data is to be read. The type must support
@@ -479,16 +483,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest read_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest async_read_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the stream's async_read_some function are
- * required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the stream's async_read_some function.
  *
  * @param handler The handler to be called when the read operation completes.
  * Copies will be made of the handler as required. The function signature of the

Modified: branches/release/boost/asio/read_at.hpp
==============================================================================
--- branches/release/boost/asio/read_at.hpp (original)
+++ branches/release/boost/asio/read_at.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -49,7 +49,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * read_some_at function.
  *
  * @param d The device from which the data is to be read. The type must support
@@ -93,7 +93,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * read_some_at function.
  *
  * @param d The device from which the data is to be read. The type must support
@@ -108,16 +108,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
+ * @code std::size_t completion_condition(
  * // Result of latest read_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the device's read_some_at function are
- * required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the device's read_some_at function.
  *
  * @returns The number of bytes transferred.
  *
@@ -149,7 +149,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * read_some_at function.
  *
  * @param d The device from which the data is to be read. The type must support
@@ -164,16 +164,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest read_some_at
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest read_some_at operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the device's read_some_at function are
- * required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the device's read_some_at function.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
@@ -195,7 +195,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * read_some_at function.
  *
  * @param d The device from which the data is to be read. The type must support
@@ -227,7 +227,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * read_some_at function.
  *
  * @param d The device from which the data is to be read. The type must support
@@ -240,16 +240,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
+ * @code std::size_t completion_condition(
  * // Result of latest read_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the device's read_some_at function are
- * required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the device's read_some_at function.
  *
  * @returns The number of bytes transferred.
  *
@@ -270,7 +270,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * read_some_at function.
  *
  * @param d The device from which the data is to be read. The type must support
@@ -283,16 +283,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
+ * @code std::size_t completion_condition(
  * // Result of latest read_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the device's read_some_at function are
- * required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the device's read_some_at function.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
@@ -327,7 +327,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * async_read_some_at function.
  *
  * @param d The device from which the data is to be read. The type must support
@@ -405,16 +405,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * // Result of latest read_some_at operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest async_read_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the device's async_read_some_at function are
- * required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the device's async_read_some_at function.
  *
  * @param handler The handler to be called when the read operation completes.
  * Copies will be made of the handler as required. The function signature of the
@@ -459,7 +459,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * async_read_some_at function.
  *
  * @param d The device from which the data is to be read. The type must support
@@ -509,7 +509,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * async_read_some_at function.
  *
  * @param d The device from which the data is to be read. The type must support
@@ -524,16 +524,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the read operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * // Result of latest read_some_at operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest async_read_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the read operation is complete. False
- * indicates that further calls to the device's async_read_some_at function are
- * required.
+ * A return value of 0 indicates that the read operation is complete. A non-zero
+ * return value indicates the maximum number of bytes to be read on the next
+ * call to the device's async_read_some_at function.
  *
  * @param handler The handler to be called when the read operation completes.
  * Copies will be made of the handler as required. The function signature of the

Modified: branches/release/boost/asio/ssl/detail/openssl_operation.hpp
==============================================================================
--- branches/release/boost/asio/ssl/detail/openssl_operation.hpp (original)
+++ branches/release/boost/asio/ssl/detail/openssl_operation.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -159,6 +159,10 @@
           0;
     int sys_error_code = ERR_get_error();
 
+ if (error_code == SSL_ERROR_SSL)
+ return handler_(boost::system::error_code(
+ error_code, boost::asio::error::get_ssl_category()), rc);
+
     bool is_read_needed = (error_code == SSL_ERROR_WANT_READ);
     bool is_write_needed = (error_code == SSL_ERROR_WANT_WRITE ||
                               ::BIO_ctrl_pending( ssl_bio_ ));

Modified: branches/release/boost/asio/ssl/detail/openssl_stream_service.hpp
==============================================================================
--- branches/release/boost/asio/ssl/detail/openssl_stream_service.hpp (original)
+++ branches/release/boost/asio/ssl/detail/openssl_stream_service.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -337,7 +337,7 @@
         buffer_size = max_buffer_size;
 
       boost::function<int (SSL*)> send_func =
- boost::bind(&::SSL_write, boost::arg<1>(),
+ boost::bind<int>(&::SSL_write, boost::arg<1>(),
             boost::asio::buffer_cast<const void*>(*buffers.begin()),
             static_cast<int>(buffer_size));
       openssl_operation<Stream> op(
@@ -373,7 +373,7 @@
       buffer_size = max_buffer_size;
 
     boost::function<int (SSL*)> send_func =
- boost::bind(&::SSL_write, boost::arg<1>(),
+ boost::bind<int>(&::SSL_write, boost::arg<1>(),
           boost::asio::buffer_cast<const void*>(*buffers.begin()),
           static_cast<int>(buffer_size));
 
@@ -411,7 +411,7 @@
         buffer_size = max_buffer_size;
 
       boost::function<int (SSL*)> recv_func =
- boost::bind(&::SSL_read, boost::arg<1>(),
+ boost::bind<int>(&::SSL_read, boost::arg<1>(),
             boost::asio::buffer_cast<void*>(*buffers.begin()),
             static_cast<int>(buffer_size));
       openssl_operation<Stream> op(recv_func,
@@ -447,7 +447,7 @@
       buffer_size = max_buffer_size;
 
     boost::function<int (SSL*)> recv_func =
- boost::bind(&::SSL_read, boost::arg<1>(),
+ boost::bind<int>(&::SSL_read, boost::arg<1>(),
           boost::asio::buffer_cast<void*>(*buffers.begin()),
           static_cast<int>(buffer_size));
 

Modified: branches/release/boost/asio/ssl/stream.hpp
==============================================================================
--- branches/release/boost/asio/ssl/stream.hpp (original)
+++ branches/release/boost/asio/ssl/stream.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -150,6 +150,19 @@
     return next_layer_.lowest_layer();
   }
 
+ /// Get a const reference to the lowest layer.
+ /**
+ * This function returns a const reference to the lowest layer in a stack of
+ * stream layers.
+ *
+ * @return A const reference to the lowest layer in the stack of stream
+ * layers. Ownership is not transferred to the caller.
+ */
+ const lowest_layer_type& lowest_layer() const
+ {
+ return next_layer_.lowest_layer();
+ }
+
   /// Get the underlying implementation in the native type.
   /**
    * This function may be used to obtain the underlying implementation of the

Modified: branches/release/boost/asio/version.hpp
==============================================================================
--- branches/release/boost/asio/version.hpp (original)
+++ branches/release/boost/asio/version.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -18,6 +18,6 @@
 // BOOST_ASIO_VERSION % 100 is the sub-minor version
 // BOOST_ASIO_VERSION / 100 % 1000 is the minor version
 // BOOST_ASIO_VERSION / 100000 is the major version
-#define BOOST_ASIO_VERSION 100200 // 1.2.0
+#define BOOST_ASIO_VERSION 100300 // 1.3.0
 
 #endif // BOOST_ASIO_VERSION_HPP

Modified: branches/release/boost/asio/windows/basic_handle.hpp
==============================================================================
--- branches/release/boost/asio/windows/basic_handle.hpp (original)
+++ branches/release/boost/asio/windows/basic_handle.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -95,6 +95,20 @@
     return *this;
   }
 
+ /// Get a const reference to the lowest layer.
+ /**
+ * This function returns a const reference to the lowest layer in a stack of
+ * layers. Since a basic_handle cannot contain any further layers, it simply
+ * returns a reference to itself.
+ *
+ * @return A const reference to the lowest layer in the stack of layers.
+ * Ownership is not transferred to the caller.
+ */
+ const lowest_layer_type& lowest_layer() const
+ {
+ return *this;
+ }
+
   /// Assign an existing native handle to the handle.
   /*
    * This function opens the handle to hold an existing native handle.

Modified: branches/release/boost/asio/write.hpp
==============================================================================
--- branches/release/boost/asio/write.hpp (original)
+++ branches/release/boost/asio/write.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -45,7 +45,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * write_some function.
  *
  * @param s The stream to which the data is to be written. The type must support
@@ -84,7 +84,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * write_some function.
  *
  * @param s The stream to which the data is to be written. The type must support
@@ -97,16 +97,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest write_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest write_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the stream's write_some function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the stream's write_some function.
  *
  * @returns The number of bytes transferred.
  *
@@ -135,7 +135,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * write_some function.
  *
  * @param s The stream to which the data is to be written. The type must support
@@ -148,16 +148,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest write_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest write_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the stream's write_some function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the stream's write_some function.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
@@ -178,7 +178,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * write_some function.
  *
  * @param s The stream to which the data is to be written. The type must support
@@ -207,7 +207,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * write_some function.
  *
  * @param s The stream to which the data is to be written. The type must support
@@ -218,16 +218,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest write_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest write_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the stream's write_some function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the stream's write_some function.
  *
  * @returns The number of bytes transferred.
  *
@@ -247,7 +247,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * write_some function.
  *
  * @param s The stream to which the data is to be written. The type must support
@@ -258,16 +258,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest write_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest write_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the stream's write_some function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the stream's write_some function.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
@@ -301,7 +301,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * async_write_some function.
  *
  * @param s The stream to which the data is to be written. The type must support
@@ -355,7 +355,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * async_write_some function.
  *
  * @param s The stream to which the data is to be written. The type must support
@@ -369,16 +369,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest write_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest async_write_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the stream's async_write_some function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the stream's async_write_some function.
  *
  * @param handler The handler to be called when the write operation completes.
  * Copies will be made of the handler as required. The function signature of the
@@ -423,7 +423,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * async_write_some function.
  *
  * @param s The stream to which the data is to be written. The type must support
@@ -465,7 +465,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the stream's
+ * This operation is implemented in terms of zero or more calls to the stream's
  * async_write_some function.
  *
  * @param s The stream to which the data is to be written. The type must support
@@ -478,16 +478,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * const boost::system::error_code& error, // Result of latest write_some
- * // operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest async_write_some operation.
+ * const boost::system::error_code& error,
  *
- * std::size_t bytes_transferred // Number of bytes transferred
- * // so far.
+ * // Number of bytes transferred so far.
+ * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the stream's async_write_some function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the stream's async_write_some function.
  *
  * @param handler The handler to be called when the write operation completes.
  * Copies will be made of the handler as required. The function signature of the

Modified: branches/release/boost/asio/write_at.hpp
==============================================================================
--- branches/release/boost/asio/write_at.hpp (original)
+++ branches/release/boost/asio/write_at.hpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -47,7 +47,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * write_some_at function.
  *
  * @param d The device to which the data is to be written. The type must support
@@ -90,7 +90,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * write_some_at function.
  *
  * @param d The device to which the data is to be written. The type must support
@@ -105,16 +105,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
+ * @code std::size_t completion_condition(
  * // Result of latest write_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the device's write_some_at function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the device's write_some_at function.
  *
  * @returns The number of bytes transferred.
  *
@@ -145,7 +145,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * write_some_at function.
  *
  * @param d The device to which the data is to be written. The type must support
@@ -160,16 +160,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
+ * @code std::size_t completion_condition(
  * // Result of latest write_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the device's write_some_at function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the device's write_some_at function.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
@@ -192,7 +192,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * write_some_at function.
  *
  * @param d The device to which the data is to be written. The type must support
@@ -225,7 +225,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * write_some_at function.
  *
  * @param d The device to which the data is to be written. The type must support
@@ -238,16 +238,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
+ * @code std::size_t completion_condition(
  * // Result of latest write_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the device's write_some_at function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the device's write_some_at function.
  *
  * @returns The number of bytes transferred.
  *
@@ -268,7 +268,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * write_some_at function.
  *
  * @param d The device to which the data is to be written. The type must support
@@ -281,16 +281,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
+ * @code std::size_t completion_condition(
  * // Result of latest write_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the device's write_some_at function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the device's write_some_at function.
  *
  * @param ec Set to indicate what error occurred, if any.
  *
@@ -325,7 +325,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * async_write_some_at function.
  *
  * @param d The device to which the data is to be written. The type must support
@@ -381,7 +381,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * async_write_some_at function.
  *
  * @param d The device to which the data is to be written. The type must support
@@ -397,16 +397,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
- * // Result of latest write_some_at operation.
+ * @code std::size_t completion_condition(
+ * // Result of latest async_write_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the device's async_write_some_at function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the device's async_write_some_at function.
  *
  * @param handler The handler to be called when the write operation completes.
  * Copies will be made of the handler as required. The function signature of the
@@ -452,7 +452,7 @@
  *
  * @li An error occurred.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * async_write_some_at function.
  *
  * @param d The device to which the data is to be written. The type must support
@@ -497,7 +497,7 @@
  *
  * @li The completion_condition function object returns true.
  *
- * This operation is implemented in terms of one or more calls to the device's
+ * This operation is implemented in terms of zero or more calls to the device's
  * async_write_some_at function.
  *
  * @param d The device to which the data is to be written. The type must support
@@ -512,16 +512,16 @@
  * @param completion_condition The function object to be called to determine
  * whether the write operation is complete. The signature of the function object
  * must be:
- * @code bool completion_condition(
+ * @code std::size_t completion_condition(
  * // Result of latest async_write_some_at operation.
  * const boost::system::error_code& error,
  *
  * // Number of bytes transferred so far.
  * std::size_t bytes_transferred
  * ); @endcode
- * A return value of true indicates that the write operation is complete. False
- * indicates that further calls to the device's async_write_some_at function are
- * required.
+ * A return value of 0 indicates that the write operation is complete. A
+ * non-zero return value indicates the maximum number of bytes to be written on
+ * the next call to the device's async_write_some_at function.
  *
  * @param handler The handler to be called when the write operation completes.
  * Copies will be made of the handler as required. The function signature of the

Modified: branches/release/libs/asio/doc/Jamfile.v2
==============================================================================
--- branches/release/libs/asio/doc/Jamfile.v2 (original)
+++ branches/release/libs/asio/doc/Jamfile.v2 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -34,7 +34,7 @@
 
 local example-names = allocation buffers chat echo http/client http/server
   http/server2 http/server3 invocation iostreams local multicast nonblocking
- porthopper serialization services socks4 ssl timeouts timers ;
+ porthopper serialization services socks4 ssl timeouts timers windows ;
 
 for local l in $(example-names)
 {

Modified: branches/release/libs/asio/doc/doxy2qbk.pl
==============================================================================
--- branches/release/libs/asio/doc/doxy2qbk.pl (original)
+++ branches/release/libs/asio/doc/doxy2qbk.pl 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -19,4 +19,4 @@
 system("xsltproc combine.xslt index.xml > all.xml");
 chdir("..");
 system("xsltproc tutorial.xsl xml/all.xml > tutorial.qbk");
-system("rm -rf xml");
+system("rm -rf xml reference.tags");

Modified: branches/release/libs/asio/doc/examples.qbk
==============================================================================
--- branches/release/libs/asio/doc/examples.qbk (original)
+++ branches/release/libs/asio/doc/examples.qbk 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -246,4 +246,12 @@
 * [@boost_asio/example/local/stream_client.cpp]
 
 
+[heading Windows]
+
+An example showing how to use the Windows-specific function `TransmitFile`
+with Boost.Asio.
+
+* [@boost_asio/example/windows/transmit_file.cpp]
+
+
 [endsect]

Modified: branches/release/libs/asio/doc/quickref.xml
==============================================================================
--- branches/release/libs/asio/doc/quickref.xml (original)
+++ branches/release/libs/asio/doc/quickref.xml 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -393,6 +393,7 @@
         <entry valign="top" namest="c" nameend="d">
           <bridgehead renderas="sect3">Classes</bridgehead>
           <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.windows__overlapped_ptr">windows::overlapped_ptr</link></member>
             <member><link linkend="boost_asio.reference.windows__random_access_handle">windows::random_access_handle</link></member>
             <member><link linkend="boost_asio.reference.windows__stream_handle">windows::stream_handle</link></member>
           </simplelist>

Modified: branches/release/libs/asio/doc/reference.qbk
==============================================================================
--- branches/release/libs/asio/doc/reference.qbk (original)
+++ branches/release/libs/asio/doc/reference.qbk 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -291,7 +291,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the stream's async\_read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function.
 
 
 [heading Parameters]
@@ -382,15 +382,15 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest read_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest async_read_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the stream's async\_read\_some function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]]
 
 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
 ``
@@ -447,7 +447,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the stream's async\_read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function.
 
 
 [heading Parameters]
@@ -514,7 +514,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's async\_read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function.
 
 
 [heading Parameters]
@@ -528,15 +528,15 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest read_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest async_read_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the stream's async\_read\_some function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]]
 
 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
 ``
@@ -632,7 +632,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the device's async\_read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function.
 
 
 [heading Parameters]
@@ -728,15 +728,15 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- // Result of latest read_some_at operation.
+ std::size_t completion_condition(
+ // Result of latest async_read_some_at operation.
      const boost::system::error_code& error,
 
      // Number of bytes transferred so far.
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the device's async\_read\_some\_at function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's async\_read\_some\_at function.]]
 
 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
 ``
@@ -794,7 +794,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the device's async\_read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function.
 
 
 [heading Parameters]
@@ -864,7 +864,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's async\_read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function.
 
 
 [heading Parameters]
@@ -880,15 +880,15 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- // Result of latest read_some_at operation.
+ std::size_t completion_condition(
+ // Result of latest async_read_some_at operation.
      const boost::system::error_code& error,
 
      // Number of bytes transferred so far.
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the device's async\_read\_some\_at function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's async\_read\_some\_at function.]]
 
 [[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
 ``
@@ -1413,7 +1413,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the stream's async\_write\_some function.
+This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function.
 
 
 [heading Parameters]
@@ -1480,7 +1480,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's async\_write\_some function.
+This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function.
 
 
 [heading Parameters]
@@ -1494,15 +1494,15 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest write_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest async_write_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the stream's async\_write\_some function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]]
 
 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
 ``
@@ -1560,7 +1560,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the stream's async\_write\_some function.
+This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function.
 
 
 [heading Parameters]
@@ -1616,7 +1616,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's async\_write\_some function.
+This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function.
 
 
 [heading Parameters]
@@ -1630,15 +1630,15 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest write_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest async_write_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the stream's async\_write\_some function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]]
 
 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
 ``
@@ -1733,7 +1733,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the device's async\_write\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function.
 
 
 [heading Parameters]
@@ -1803,7 +1803,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's async\_write\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function.
 
 
 [heading Parameters]
@@ -1819,15 +1819,15 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- // Result of latest write_some_at operation.
+ std::size_t completion_condition(
+ // Result of latest async_write_some_at operation.
      const boost::system::error_code& error,
 
      // Number of bytes transferred so far.
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the device's async\_write\_some\_at function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's async\_write\_some\_at function.]]
 
 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
 ``
@@ -1886,7 +1886,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the device's async\_write\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function.
 
 
 [heading Parameters]
@@ -1945,7 +1945,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's async\_write\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function.
 
 
 [heading Parameters]
@@ -1961,7 +1961,7 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
+ std::size_t completion_condition(
      // Result of latest async_write_some_at operation.
      const boost::system::error_code& error,
 
@@ -1969,7 +1969,7 @@
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the device's async\_write\_some\_at function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's async\_write\_some\_at function.]]
 
 [[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
 ``
@@ -4425,13 +4425,21 @@
 
 [endsect]
 
-
 [section:lowest_layer basic_datagram_socket::lowest_layer]
 
+[indexterm2 lowest_layer..basic_datagram_socket] Get a reference to the lowest layer.
+
+ lowest_layer_type & ``[link boost_asio.reference.basic_datagram_socket.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.basic_datagram_socket.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 basic_datagram_socket::lowest_layer (1 of 2 overloads)]
+
 
 ['Inherited from basic_socket.]
 
-[indexterm2 lowest_layer..basic_datagram_socket] Get a reference to the lowest layer.
+Get a reference to the lowest layer.
 
   lowest_layer_type & lowest_layer();
 
@@ -4449,6 +4457,31 @@
 
 
 
+[section:overload2 basic_datagram_socket::lowest_layer (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_socket cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type basic_datagram_socket::lowest_layer_type]
 
 
@@ -9816,13 +9849,21 @@
 
 [endsect]
 
-
 [section:lowest_layer basic_raw_socket::lowest_layer]
 
+[indexterm2 lowest_layer..basic_raw_socket] Get a reference to the lowest layer.
+
+ lowest_layer_type & ``[link boost_asio.reference.basic_raw_socket.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.basic_raw_socket.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 basic_raw_socket::lowest_layer (1 of 2 overloads)]
+
 
 ['Inherited from basic_socket.]
 
-[indexterm2 lowest_layer..basic_raw_socket] Get a reference to the lowest layer.
+Get a reference to the lowest layer.
 
   lowest_layer_type & lowest_layer();
 
@@ -9840,6 +9881,31 @@
 
 
 
+[section:overload2 basic_raw_socket::lowest_layer (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_socket cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type basic_raw_socket::lowest_layer_type]
 
 
@@ -12487,11 +12553,19 @@
 [endsect]
 
 
-
 [section:lowest_layer basic_serial_port::lowest_layer]
 
 [indexterm2 lowest_layer..basic_serial_port] Get a reference to the lowest layer.
 
+ lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 basic_serial_port::lowest_layer (1 of 2 overloads)]
+
+Get a reference to the lowest layer.
+
   lowest_layer_type & lowest_layer();
 
 
@@ -12508,6 +12582,28 @@
 
 
 
+[section:overload2 basic_serial_port::lowest_layer (2 of 2 overloads)]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_serial_port cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type basic_serial_port::lowest_layer_type]
 
 [indexterm2 lowest_layer_type..basic_serial_port] A basic_serial_port is always the lowest layer.
@@ -15052,11 +15148,19 @@
 
 [endsect]
 
-
 [section:lowest_layer basic_socket::lowest_layer]
 
 [indexterm2 lowest_layer..basic_socket] Get a reference to the lowest layer.
 
+ lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 basic_socket::lowest_layer (1 of 2 overloads)]
+
+Get a reference to the lowest layer.
+
   lowest_layer_type & lowest_layer();
 
 
@@ -15073,6 +15177,28 @@
 
 
 
+[section:overload2 basic_socket::lowest_layer (2 of 2 overloads)]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_socket cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type basic_socket::lowest_layer_type]
 
 [indexterm2 lowest_layer_type..basic_socket] A basic_socket is always the lowest layer.
@@ -20657,13 +20783,21 @@
 
 [endsect]
 
-
 [section:lowest_layer basic_socket_streambuf::lowest_layer]
 
+[indexterm2 lowest_layer..basic_socket_streambuf] Get a reference to the lowest layer.
+
+ lowest_layer_type & ``[link boost_asio.reference.basic_socket_streambuf.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.basic_socket_streambuf.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 basic_socket_streambuf::lowest_layer (1 of 2 overloads)]
+
 
 ['Inherited from basic_socket.]
 
-[indexterm2 lowest_layer..basic_socket_streambuf] Get a reference to the lowest layer.
+Get a reference to the lowest layer.
 
   lowest_layer_type & lowest_layer();
 
@@ -20681,6 +20815,31 @@
 
 
 
+[section:overload2 basic_socket_streambuf::lowest_layer (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_socket cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type basic_socket_streambuf::lowest_layer_type]
 
 
@@ -24282,13 +24441,21 @@
 
 [endsect]
 
-
 [section:lowest_layer basic_stream_socket::lowest_layer]
 
+[indexterm2 lowest_layer..basic_stream_socket] Get a reference to the lowest layer.
+
+ lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 basic_stream_socket::lowest_layer (1 of 2 overloads)]
+
 
 ['Inherited from basic_socket.]
 
-[indexterm2 lowest_layer..basic_stream_socket] Get a reference to the lowest layer.
+Get a reference to the lowest layer.
 
   lowest_layer_type & lowest_layer();
 
@@ -24306,6 +24473,31 @@
 
 
 
+[section:overload2 basic_stream_socket::lowest_layer (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_socket cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type basic_stream_socket::lowest_layer_type]
 
 
@@ -27617,11 +27809,19 @@
 [endsect]
 
 
-
 [section:lowest_layer buffered_read_stream::lowest_layer]
 
 [indexterm2 lowest_layer..buffered_read_stream] Get a reference to the lowest layer.
 
+ lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 buffered_read_stream::lowest_layer (1 of 2 overloads)]
+
+Get a reference to the lowest layer.
+
   lowest_layer_type & lowest_layer();
 
 
@@ -27630,6 +27830,20 @@
 
 
 
+[section:overload2 buffered_read_stream::lowest_layer (2 of 2 overloads)]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type buffered_read_stream::lowest_layer_type]
 
 [indexterm2 lowest_layer_type..buffered_read_stream] The type of the lowest layer.
@@ -28222,11 +28436,19 @@
 [endsect]
 
 
-
 [section:lowest_layer buffered_stream::lowest_layer]
 
 [indexterm2 lowest_layer..buffered_stream] Get a reference to the lowest layer.
 
+ lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 buffered_stream::lowest_layer (1 of 2 overloads)]
+
+Get a reference to the lowest layer.
+
   lowest_layer_type & lowest_layer();
 
 
@@ -28235,6 +28457,20 @@
 
 
 
+[section:overload2 buffered_stream::lowest_layer (2 of 2 overloads)]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type buffered_stream::lowest_layer_type]
 
 [indexterm2 lowest_layer_type..buffered_stream] The type of the lowest layer.
@@ -28787,11 +29023,19 @@
 [endsect]
 
 
-
 [section:lowest_layer buffered_write_stream::lowest_layer]
 
 [indexterm2 lowest_layer..buffered_write_stream] Get a reference to the lowest layer.
 
+ lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 buffered_write_stream::lowest_layer (1 of 2 overloads)]
+
+Get a reference to the lowest layer.
+
   lowest_layer_type & lowest_layer();
 
 
@@ -28800,6 +29044,20 @@
 
 
 
+[section:overload2 buffered_write_stream::lowest_layer (2 of 2 overloads)]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type buffered_write_stream::lowest_layer_type]
 
 [indexterm2 lowest_layer_type..buffered_write_stream] The type of the lowest layer.
@@ -35225,7 +35483,7 @@
 
   [
     [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
- [Asynchronously resolve a query to a list of entries. ]
+ [Asynchronously perform forward resolution of a query to a list of entries. ]
   ]
   
   [
@@ -35250,7 +35508,7 @@
   
   [
     [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
- [Resolve a query to a list of entries. ]
+ [Perform forward resolution of a query to a list of entries. ]
   ]
   
 ]
@@ -35283,7 +35541,7 @@
 
 [section:async_resolve ip::basic_resolver::async_resolve]
 
-[indexterm2 async_resolve..ip::basic_resolver] Asynchronously resolve a query to a list of entries.
+[indexterm2 async_resolve..ip::basic_resolver] Asynchronously perform forward resolution of a query to a list of entries.
 
   template<
       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
@@ -35300,7 +35558,7 @@
 
 [section:overload1 ip::basic_resolver::async_resolve (1 of 2 overloads)]
 
-Asynchronously resolve a query to a list of entries.
+Asynchronously perform forward resolution of a query to a list of entries.
 
   template<
       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
@@ -35345,7 +35603,7 @@
 
 [section:overload2 ip::basic_resolver::async_resolve (2 of 2 overloads)]
 
-Asynchronously resolve an endpoint to a list of entries.
+Asynchronously perform reverse resolution of an endpoint to a list of entries.
 
   template<
       typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
@@ -35560,7 +35818,7 @@
 
 [section:resolve ip::basic_resolver::resolve]
 
-[indexterm2 resolve..ip::basic_resolver] Resolve a query to a list of entries.
+[indexterm2 resolve..ip::basic_resolver] Perform forward resolution of a query to a list of entries.
 
   iterator ``[link boost_asio.reference.ip__basic_resolver.resolve.overload1 resolve]``(
       const query & q);
@@ -35579,7 +35837,7 @@
 
 [section:overload1 ip::basic_resolver::resolve (1 of 4 overloads)]
 
-Resolve a query to a list of entries.
+Perform forward resolution of a query to a list of entries.
 
   iterator resolve(
       const query & q);
@@ -35623,7 +35881,7 @@
 
 [section:overload2 ip::basic_resolver::resolve (2 of 4 overloads)]
 
-Resolve a query to a list of entries.
+Perform forward resolution of a query to a list of entries.
 
   iterator resolve(
       const query & q,
@@ -35661,7 +35919,7 @@
 
 [section:overload3 ip::basic_resolver::resolve (3 of 4 overloads)]
 
-Resolve an endpoint to a list of entries.
+Perform reverse resolution of an endpoint to a list of entries.
 
   iterator resolve(
       const endpoint_type & e);
@@ -35705,7 +35963,7 @@
 
 [section:overload4 ip::basic_resolver::resolve (4 of 4 overloads)]
 
-Resolve an endpoint to a list of entries.
+Perform reverse resolution of an endpoint to a list of entries.
 
   iterator resolve(
       const endpoint_type & e,
@@ -36795,7 +37053,7 @@
 
   [
     [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
- [Asynchronously resolve a query to a list of entries. ]
+ [Asynchronously perform forward resolution of a query to a list of entries. ]
   ]
   
   [
@@ -36820,7 +37078,7 @@
   
   [
     [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
- [Resolve a query to a list of entries. ]
+ [Perform forward resolution of a query to a list of entries. ]
   ]
   
 ]
@@ -38891,7 +39149,7 @@
 
   [
     [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
- [Asynchronously resolve a query to a list of entries. ]
+ [Asynchronously perform forward resolution of a query to a list of entries. ]
   ]
   
   [
@@ -38916,7 +39174,7 @@
   
   [
     [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
- [Resolve a query to a list of entries. ]
+ [Perform forward resolution of a query to a list of entries. ]
   ]
   
 ]
@@ -39858,7 +40116,7 @@
 
   [
     [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
- [Asynchronously resolve a query to a list of entries. ]
+ [Asynchronously perform forward resolution of a query to a list of entries. ]
   ]
   
   [
@@ -39883,7 +40141,7 @@
   
   [
     [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
- [Resolve a query to a list of entries. ]
+ [Perform forward resolution of a query to a list of entries. ]
   ]
   
 ]
@@ -43931,11 +44189,19 @@
 [endsect]
 
 
-
 [section:lowest_layer posix::basic_descriptor::lowest_layer]
 
 [indexterm2 lowest_layer..posix::basic_descriptor] Get a reference to the lowest layer.
 
+ lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 posix::basic_descriptor::lowest_layer (1 of 2 overloads)]
+
+Get a reference to the lowest layer.
+
   lowest_layer_type & lowest_layer();
 
 
@@ -43952,6 +44218,28 @@
 
 
 
+[section:overload2 posix::basic_descriptor::lowest_layer (2 of 2 overloads)]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_descriptor cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type posix::basic_descriptor::lowest_layer_type]
 
 [indexterm2 lowest_layer_type..posix::basic_descriptor] A basic_descriptor is always the lowest layer.
@@ -44978,13 +45266,21 @@
 [endsect]
 
 
-
 [section:lowest_layer posix::basic_stream_descriptor::lowest_layer]
 
+[indexterm2 lowest_layer..posix::basic_stream_descriptor] Get a reference to the lowest layer.
+
+ lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 posix::basic_stream_descriptor::lowest_layer (1 of 2 overloads)]
+
 
 ['Inherited from posix::basic_descriptor.]
 
-[indexterm2 lowest_layer..posix::basic_stream_descriptor] Get a reference to the lowest layer.
+Get a reference to the lowest layer.
 
   lowest_layer_type & lowest_layer();
 
@@ -45002,6 +45298,31 @@
 
 
 
+[section:overload2 posix::basic_stream_descriptor::lowest_layer (2 of 2 overloads)]
+
+
+['Inherited from posix::basic_descriptor.]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_descriptor cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type posix::basic_stream_descriptor::lowest_layer_type]
 
 
@@ -47006,7 +47327,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the stream's read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
 
 [heading Parameters]
@@ -47082,7 +47403,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
 
 [heading Parameters]
@@ -47096,15 +47417,15 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest read_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest read_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the stream's read\_some function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
 
 ]
 
@@ -47161,7 +47482,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
 
 [heading Parameters]
@@ -47175,15 +47496,15 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest read_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest read_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the stream's read\_some function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
@@ -47216,7 +47537,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the stream's read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
 
 [heading Parameters]
@@ -47279,7 +47600,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
 
 [heading Parameters]
@@ -47293,15 +47614,15 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest read_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest read_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the stream's read\_some function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
 
 ]
 
@@ -47344,7 +47665,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
 
 [heading Parameters]
@@ -47358,15 +47679,15 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest read_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest read_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the stream's read\_some function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
@@ -47466,7 +47787,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the device's read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
 
 [heading Parameters]
@@ -47545,7 +47866,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
 
 [heading Parameters]
@@ -47561,7 +47882,7 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
+ std::size_t completion_condition(
      // Result of latest read_some_at operation.
      const boost::system::error_code& error,
 
@@ -47569,7 +47890,7 @@
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the device's read\_some\_at function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
 
 ]
 
@@ -47627,7 +47948,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
 
 [heading Parameters]
@@ -47643,15 +47964,15 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest read_some_at
- // operation.
+ std::size_t completion_condition(
+ // Result of latest read_some_at operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the device's read\_some\_at function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
@@ -47685,7 +48006,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the device's read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
 
 [heading Parameters]
@@ -47751,7 +48072,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
 
 [heading Parameters]
@@ -47767,7 +48088,7 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
+ std::size_t completion_condition(
      // Result of latest read_some_at operation.
      const boost::system::error_code& error,
 
@@ -47775,7 +48096,7 @@
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the device's read\_some\_at function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
 
 ]
 
@@ -47819,7 +48140,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
 
 [heading Parameters]
@@ -47835,7 +48156,7 @@
 
 [[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
+ std::size_t completion_condition(
      // Result of latest read_some_at operation.
      const boost::system::error_code& error,
 
@@ -47843,7 +48164,7 @@
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the read operation is complete. False indicates that further calls to the device's read\_some\_at function are required.]]
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
@@ -54041,11 +54362,19 @@
 [endsect]
 
 
-
 [section:lowest_layer ssl::stream::lowest_layer]
 
 [indexterm2 lowest_layer..ssl::stream] Get a reference to the lowest layer.
 
+ lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 ssl::stream::lowest_layer (1 of 2 overloads)]
+
+Get a reference to the lowest layer.
+
   lowest_layer_type & lowest_layer();
 
 
@@ -54062,6 +54391,28 @@
 
 
 
+[section:overload2 ssl::stream::lowest_layer (2 of 2 overloads)]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of stream layers.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type ssl::stream::lowest_layer_type]
 
 [indexterm2 lowest_layer_type..ssl::stream] The type of the lowest layer.
@@ -56594,11 +56945,19 @@
 [endsect]
 
 
-
 [section:lowest_layer windows::basic_handle::lowest_layer]
 
 [indexterm2 lowest_layer..windows::basic_handle] Get a reference to the lowest layer.
 
+ lowest_layer_type & ``[link boost_asio.reference.windows__basic_handle.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.windows__basic_handle.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 windows::basic_handle::lowest_layer (1 of 2 overloads)]
+
+Get a reference to the lowest layer.
+
   lowest_layer_type & lowest_layer();
 
 
@@ -56615,6 +56974,28 @@
 
 
 
+[section:overload2 windows::basic_handle::lowest_layer (2 of 2 overloads)]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_handle cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type windows::basic_handle::lowest_layer_type]
 
 [indexterm2 lowest_layer_type..windows::basic_handle] A basic_handle is always the lowest layer.
@@ -57430,13 +57811,21 @@
 [endsect]
 
 
-
 [section:lowest_layer windows::basic_random_access_handle::lowest_layer]
 
+[indexterm2 lowest_layer..windows::basic_random_access_handle] Get a reference to the lowest layer.
+
+ lowest_layer_type & ``[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.windows__basic_random_access_handle.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 windows::basic_random_access_handle::lowest_layer (1 of 2 overloads)]
+
 
 ['Inherited from windows::basic_handle.]
 
-[indexterm2 lowest_layer..windows::basic_random_access_handle] Get a reference to the lowest layer.
+Get a reference to the lowest layer.
 
   lowest_layer_type & lowest_layer();
 
@@ -57454,6 +57843,31 @@
 
 
 
+[section:overload2 windows::basic_random_access_handle::lowest_layer (2 of 2 overloads)]
+
+
+['Inherited from windows::basic_handle.]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_handle cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type windows::basic_random_access_handle::lowest_layer_type]
 
 
@@ -58501,13 +58915,21 @@
 [endsect]
 
 
-
 [section:lowest_layer windows::basic_stream_handle::lowest_layer]
 
+[indexterm2 lowest_layer..windows::basic_stream_handle] Get a reference to the lowest layer.
+
+ lowest_layer_type & ``[link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload1 lowest_layer]``();
+
+ const lowest_layer_type & ``[link boost_asio.reference.windows__basic_stream_handle.lowest_layer.overload2 lowest_layer]``() const;
+
+
+[section:overload1 windows::basic_stream_handle::lowest_layer (1 of 2 overloads)]
+
 
 ['Inherited from windows::basic_handle.]
 
-[indexterm2 lowest_layer..windows::basic_stream_handle] Get a reference to the lowest layer.
+Get a reference to the lowest layer.
 
   lowest_layer_type & lowest_layer();
 
@@ -58525,6 +58947,31 @@
 
 
 
+[section:overload2 windows::basic_stream_handle::lowest_layer (2 of 2 overloads)]
+
+
+['Inherited from windows::basic_handle.]
+
+Get a const reference to the lowest layer.
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a basic_handle cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:lowest_layer_type windows::basic_stream_handle::lowest_layer_type]
 
 
@@ -58954,6 +59401,219 @@
 
 [endsect]
 
+[section:windows__overlapped_ptr windows::overlapped_ptr]
+
+Wraps a handler to create an OVERLAPPED object for use with overlapped I/O.
+
+ class overlapped_ptr :
+ noncopyable
+
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.windows__overlapped_ptr.complete [*complete]]]
+ [Post completion notification for overlapped operation. Releases ownership. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__overlapped_ptr.get [*get]]]
+ [Get the contained OVERLAPPED object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr [*overlapped_ptr]]]
+ [Construct an empty overlapped_ptr. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__overlapped_ptr.release [*release]]]
+ [Release ownership of the OVERLAPPED object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__overlapped_ptr.reset [*reset]]]
+ [Reset to empty. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__overlapped_ptr._overlapped_ptr [*~overlapped_ptr]]]
+ [Destructor automatically frees the OVERLAPPED object unless released. ]
+ ]
+
+]
+
+A special-purpose smart pointer used to wrap an application handler so that it can be passed as the LPOVERLAPPED argument to overlapped I/O functions.
+
+
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
+
+
+
+[section:complete windows::overlapped_ptr::complete]
+
+[indexterm2 complete..windows::overlapped_ptr] Post completion notification for overlapped operation. Releases ownership.
+
+ void complete(
+ const boost::system::error_code & ec,
+ std::size_t bytes_transferred);
+
+
+
+[endsect]
+
+
+[section:get windows::overlapped_ptr::get]
+
+[indexterm2 get..windows::overlapped_ptr] Get the contained OVERLAPPED object.
+
+ OVERLAPPED * ``[link boost_asio.reference.windows__overlapped_ptr.get.overload1 get]``();
+
+ const OVERLAPPED * ``[link boost_asio.reference.windows__overlapped_ptr.get.overload2 get]``() const;
+
+
+[section:overload1 windows::overlapped_ptr::get (1 of 2 overloads)]
+
+Get the contained OVERLAPPED object.
+
+ OVERLAPPED * get();
+
+
+
+[endsect]
+
+
+
+[section:overload2 windows::overlapped_ptr::get (2 of 2 overloads)]
+
+Get the contained OVERLAPPED object.
+
+ const OVERLAPPED * get() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:overlapped_ptr windows::overlapped_ptr::overlapped_ptr]
+
+[indexterm2 overlapped_ptr..windows::overlapped_ptr] Construct an empty overlapped_ptr.
+
+ ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload1 overlapped_ptr]``();
+
+ template<
+ typename ``[link boost_asio.reference.Handler Handler]``>
+ ``[link boost_asio.reference.windows__overlapped_ptr.overlapped_ptr.overload2 overlapped_ptr]``(
+ boost::asio::io_service & io_service,
+ Handler handler);
+
+
+[section:overload1 windows::overlapped_ptr::overlapped_ptr (1 of 2 overloads)]
+
+Construct an empty overlapped_ptr.
+
+ overlapped_ptr();
+
+
+
+[endsect]
+
+
+
+[section:overload2 windows::overlapped_ptr::overlapped_ptr (2 of 2 overloads)]
+
+Construct an overlapped_ptr to contain the specified handler.
+
+ template<
+ typename ``[link boost_asio.reference.Handler Handler]``>
+ overlapped_ptr(
+ boost::asio::io_service & io_service,
+ Handler handler);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:release windows::overlapped_ptr::release]
+
+[indexterm2 release..windows::overlapped_ptr] Release ownership of the OVERLAPPED object.
+
+ OVERLAPPED * release();
+
+
+
+[endsect]
+
+
+[section:reset windows::overlapped_ptr::reset]
+
+[indexterm2 reset..windows::overlapped_ptr] Reset to empty.
+
+ void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload1 reset]``();
+
+ template<
+ typename ``[link boost_asio.reference.Handler Handler]``>
+ void ``[link boost_asio.reference.windows__overlapped_ptr.reset.overload2 reset]``(
+ boost::asio::io_service & io_service,
+ Handler handler);
+
+
+[section:overload1 windows::overlapped_ptr::reset (1 of 2 overloads)]
+
+Reset to empty.
+
+ void reset();
+
+
+
+[endsect]
+
+
+
+[section:overload2 windows::overlapped_ptr::reset (2 of 2 overloads)]
+
+Reset to contain the specified handler, freeing any current OVERLAPPED object.
+
+ template<
+ typename ``[link boost_asio.reference.Handler Handler]``>
+ void reset(
+ boost::asio::io_service & io_service,
+ Handler handler);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:_overlapped_ptr windows::overlapped_ptr::~overlapped_ptr]
+
+[indexterm2 ~overlapped_ptr..windows::overlapped_ptr] Destructor automatically frees the OVERLAPPED object unless released.
+
+ ~overlapped_ptr();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
 
 [section:windows__random_access_handle windows::random_access_handle]
 
@@ -60084,7 +60744,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the stream's write\_some function.
+This operation is implemented in terms of zero or more calls to the stream's write\_some function.
 
 
 [heading Parameters]
@@ -60160,7 +60820,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's write\_some function.
+This operation is implemented in terms of zero or more calls to the stream's write\_some function.
 
 
 [heading Parameters]
@@ -60174,15 +60834,15 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest write_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest write_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the stream's write\_some function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
 
 ]
 
@@ -60239,7 +60899,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's write\_some function.
+This operation is implemented in terms of zero or more calls to the stream's write\_some function.
 
 
 [heading Parameters]
@@ -60253,15 +60913,15 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest write_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest write_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the stream's write\_some function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
@@ -60296,7 +60956,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the stream's write\_some function.
+This operation is implemented in terms of zero or more calls to the stream's write\_some function.
 
 
 [heading Parameters]
@@ -60361,7 +61021,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's write\_some function.
+This operation is implemented in terms of zero or more calls to the stream's write\_some function.
 
 
 [heading Parameters]
@@ -60375,15 +61035,15 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest write_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest write_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the stream's write\_some function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
 
 ]
 
@@ -60428,7 +61088,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the stream's write\_some function.
+This operation is implemented in terms of zero or more calls to the stream's write\_some function.
 
 
 [heading Parameters]
@@ -60442,15 +61102,15 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
- const boost::system::error_code& error, // Result of latest write_some
- // operation.
+ std::size_t completion_condition(
+ // Result of latest write_some operation.
+ const boost::system::error_code& error,
 
- std::size_t bytes_transferred // Number of bytes transferred
- // so far.
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the stream's write\_some function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's write\_some function.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
@@ -60550,7 +61210,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the device's write\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
 
 
 [heading Parameters]
@@ -60629,7 +61289,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's write\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
 
 
 [heading Parameters]
@@ -60645,7 +61305,7 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
+ std::size_t completion_condition(
      // Result of latest write_some_at operation.
      const boost::system::error_code& error,
 
@@ -60653,7 +61313,7 @@
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the device's write\_some\_at function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
 
 ]
 
@@ -60711,7 +61371,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's write\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
 
 
 [heading Parameters]
@@ -60727,7 +61387,7 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
+ std::size_t completion_condition(
      // Result of latest write_some_at operation.
      const boost::system::error_code& error,
 
@@ -60735,7 +61395,7 @@
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the device's write\_some\_at function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
@@ -60771,7 +61431,7 @@
 
 * An error occurred.
 
-This operation is implemented in terms of one or more calls to the device's write\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
 
 
 [heading Parameters]
@@ -60839,7 +61499,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's write\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
 
 
 [heading Parameters]
@@ -60855,7 +61515,7 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
+ std::size_t completion_condition(
      // Result of latest write_some_at operation.
      const boost::system::error_code& error,
 
@@ -60863,7 +61523,7 @@
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the device's write\_some\_at function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
 
 ]
 
@@ -60909,7 +61569,7 @@
 
 * The completion_condition function object returns true.
 
-This operation is implemented in terms of one or more calls to the device's write\_some\_at function.
+This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
 
 
 [heading Parameters]
@@ -60925,7 +61585,7 @@
 
 [[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
 ``
- bool completion_condition(
+ std::size_t completion_condition(
      // Result of latest write_some_at operation.
      const boost::system::error_code& error,
 
@@ -60933,7 +61593,7 @@
      std::size_t bytes_transferred
    );
 ``
-A return value of true indicates that the write operation is complete. False indicates that further calls to the device's write\_some\_at function are required.]]
+A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's write\_some\_at function.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 

Modified: branches/release/libs/asio/doc/using.qbk
==============================================================================
--- branches/release/libs/asio/doc/using.qbk (original)
+++ branches/release/libs/asio/doc/using.qbk 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -175,6 +175,13 @@
     ]
   ]
   [
+ [`BOOST_ASIO_DISABLE_EVENTFD`]
+ [
+ Explicitly disables `eventfd` support on Linux, forcing the use of a
+ pipe to interrupt blocked epoll/select system calls.
+ ]
+ ]
+ [
     [`BOOST_ASIO_DISABLE_KQUEUE`]
     [
       Explicitly disables `kqueue` support on Mac OS X and BSD variants,

Modified: branches/release/libs/asio/example/nonblocking/third_party_lib.cpp
==============================================================================
--- branches/release/libs/asio/example/nonblocking/third_party_lib.cpp (original)
+++ branches/release/libs/asio/example/nonblocking/third_party_lib.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -150,7 +150,7 @@
 
     // Otherwise, an error occurred. Closing the socket cancels any outstanding
     // asynchronous read or write operations. The connection object will be
- // destroyed once automatically once those outstanding operations complete.
+ // destroyed automatically once those outstanding operations complete.
     else
       socket_.close();
   }
@@ -170,7 +170,7 @@
 
     // Otherwise, an error occurred. Closing the socket cancels any outstanding
     // asynchronous read or write operations. The connection object will be
- // destroyed once automatically once those outstanding operations complete.
+ // destroyed automatically once those outstanding operations complete.
     else
       socket_.close();
   }

Modified: branches/release/libs/asio/test/Jamfile
==============================================================================
--- branches/release/libs/asio/test/Jamfile (original)
+++ branches/release/libs/asio/test/Jamfile 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -81,6 +81,7 @@
   [ run posix/stream_descriptor.cpp <template>asio_unit_test ]
   [ run posix/stream_descriptor_service.cpp <template>asio_unit_test ]
   [ run read.cpp <template>asio_unit_test ]
+ [ run read_at.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 ]
@@ -90,9 +91,11 @@
   [ run windows/basic_handle.cpp <template>asio_unit_test ]
   [ run windows/basic_random_access_handle.cpp <template>asio_unit_test ]
   [ run windows/basic_stream_handle.cpp <template>asio_unit_test ]
+ [ run windows/overlapped_ptr.cpp <template>asio_unit_test ]
   [ run windows/random_access_handle.cpp <template>asio_unit_test ]
   [ run windows/random_access_handle_service.cpp <template>asio_unit_test ]
   [ run windows/stream_handle.cpp <template>asio_unit_test ]
   [ run windows/stream_handle_service.cpp <template>asio_unit_test ]
   [ run write.cpp <template>asio_unit_test ]
+ [ run write_at.cpp <template>asio_unit_test ]
   ;

Modified: branches/release/libs/asio/test/Jamfile.v2
==============================================================================
--- branches/release/libs/asio/test/Jamfile.v2 (original)
+++ branches/release/libs/asio/test/Jamfile.v2 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -142,6 +142,8 @@
   [ link posix/stream_descriptor_service.cpp : $(USE_SELECT) : posix_stream_descriptor_service_select ]
   [ run read.cpp ]
   [ run read.cpp : : : $(USE_SELECT) : read_select ]
+ [ run read_at.cpp ]
+ [ run read_at.cpp : : : $(USE_SELECT) : read_at_select ]
   [ run read_until.cpp ]
   [ run read_until.cpp : : : $(USE_SELECT) : read_until_select ]
   [ link socket_acceptor_service.cpp ]
@@ -160,6 +162,8 @@
   [ link windows/basic_random_access_handle.cpp : $(USE_SELECT) : windows_basic_random_access_handle_select ]
   [ link windows/basic_stream_handle.cpp : : windows_basic_stream_handle ]
   [ link windows/basic_stream_handle.cpp : $(USE_SELECT) : windows_basic_stream_handle_select ]
+ [ link windows/overlapped_ptr.cpp : : windows_overlapped_ptr ]
+ [ link windows/overlapped_ptr.cpp : $(USE_SELECT) : windows_overlapped_ptr_select ]
   [ link windows/random_access_handle.cpp : : windows_random_access_handle ]
   [ link windows/random_access_handle.cpp : $(USE_SELECT) : windows_random_access_handle_select ]
   [ link windows/random_access_handle_service.cpp : : windows_random_access_handle_service ]
@@ -170,4 +174,6 @@
   [ link windows/stream_handle_service.cpp : $(USE_SELECT) : windows_stream_handle_service_select ]
   [ run write.cpp ]
   [ run write.cpp : : : $(USE_SELECT) : write_select ]
+ [ run write_at.cpp ]
+ [ run write_at.cpp : : : $(USE_SELECT) : write_at_select ]
   ;

Modified: branches/release/libs/asio/test/ip/tcp.cpp
==============================================================================
--- branches/release/libs/asio/test/ip/tcp.cpp (original)
+++ branches/release/libs/asio/test/ip/tcp.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -172,6 +172,11 @@
     ip::tcp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
     (void)lowest_layer;
 
+ const ip::tcp::socket& socket7 = socket1;
+ const ip::tcp::socket::lowest_layer_type& lowest_layer2
+ = socket7.lowest_layer();
+ (void)lowest_layer2;
+
     socket1.open(ip::tcp::v4());
     socket1.open(ip::tcp::v6());
     socket1.open(ip::tcp::v4(), ec);

Modified: branches/release/libs/asio/test/ip/udp.cpp
==============================================================================
--- branches/release/libs/asio/test/ip/udp.cpp (original)
+++ branches/release/libs/asio/test/ip/udp.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -77,6 +77,11 @@
     ip::udp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
     (void)lowest_layer;
 
+ const ip::udp::socket& socket7 = socket1;
+ const ip::udp::socket::lowest_layer_type& lowest_layer2
+ = socket7.lowest_layer();
+ (void)lowest_layer2;
+
     socket1.open(ip::udp::v4());
     socket1.open(ip::udp::v6());
     socket1.open(ip::udp::v4(), ec);

Modified: branches/release/libs/asio/test/posix/stream_descriptor.cpp
==============================================================================
--- branches/release/libs/asio/test/posix/stream_descriptor.cpp (original)
+++ branches/release/libs/asio/test/posix/stream_descriptor.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -68,6 +68,11 @@
       = descriptor1.lowest_layer();
     (void)lowest_layer;
 
+ const posix::stream_descriptor& descriptor3 = descriptor1;
+ const posix::stream_descriptor::lowest_layer_type& lowest_layer2
+ = descriptor3.lowest_layer();
+ (void)lowest_layer2;
+
     int native_descriptor2 = -1;
     descriptor1.assign(native_descriptor2);
 

Modified: branches/release/libs/asio/test/read.cpp
==============================================================================
--- branches/release/libs/asio/test/read.cpp (original)
+++ branches/release/libs/asio/test/read.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -38,7 +38,7 @@
   {
   }
 
- io_service_type& io_service()
+ io_service_type& get_io_service()
   {
     return io_service_;
   }
@@ -162,6 +162,18 @@
   BOOST_CHECK(s.check(buffers, sizeof(read_data)));
 }
 
+bool old_style_transfer_all(const boost::system::error_code& ec,
+ size_t bytes_transferred)
+{
+ return !!ec;
+}
+
+size_t short_transfer(const boost::system::error_code& ec,
+ size_t bytes_transferred)
+{
+ return !!ec ? 0 : 3;
+}
+
 void test_3_arg_read()
 {
   boost::asio::io_service ios;
@@ -261,6 +273,46 @@
       boost::asio::transfer_at_least(42));
   BOOST_CHECK(bytes_transferred == 50);
   BOOST_CHECK(s.check(buffers, 50));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers, old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers, old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers, old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
 }
 
 void test_4_arg_read()
@@ -386,6 +438,59 @@
   BOOST_CHECK(bytes_transferred == 50);
   BOOST_CHECK(s.check(buffers, 50));
   BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ old_style_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));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ old_style_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));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ old_style_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));
+ bytes_transferred = boost::asio::read(s, buffers, short_transfer, 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));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers, short_transfer, 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));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers, short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
 }
 
 void async_read_handler(const boost::system::error_code& e,
@@ -617,6 +722,88 @@
   ios.run();
   BOOST_CHECK(called);
   BOOST_CHECK(s.check(buffers, 50));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, old_style_transfer_all,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, old_style_transfer_all,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, old_style_transfer_all,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, short_transfer,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, short_transfer,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, short_transfer,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(read_data)));
 }
 
 test_suite* init_unit_test_suite(int, char*[])

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-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -36,7 +36,7 @@
   {
   }
 
- io_service_type& io_service()
+ io_service_type& get_io_service()
   {
     return io_service_;
   }

Modified: branches/release/libs/asio/test/serial_port.cpp
==============================================================================
--- branches/release/libs/asio/test/serial_port.cpp (original)
+++ branches/release/libs/asio/test/serial_port.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -39,6 +39,7 @@
 
 void test()
 {
+#if defined(BOOST_ASIO_HAS_SERIAL_PORT)
   using namespace boost::asio;
 
   try
@@ -66,6 +67,10 @@
     serial_port::lowest_layer_type& lowest_layer = port1.lowest_layer();
     (void)lowest_layer;
 
+ const serial_port& port4 = port1;
+ const serial_port::lowest_layer_type& lowest_layer2 = port4.lowest_layer();
+ (void)lowest_layer2;
+
     port1.open("null");
     port1.open("null", ec);
 
@@ -111,6 +116,7 @@
   catch (std::exception&)
   {
   }
+#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT)
 }
 
 } // namespace serial_port_compile

Modified: branches/release/libs/asio/test/serial_port_base.cpp
==============================================================================
--- branches/release/libs/asio/test/serial_port_base.cpp (original)
+++ branches/release/libs/asio/test/serial_port_base.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -31,6 +31,7 @@
 
 void test()
 {
+#if defined(BOOST_ASIO_HAS_SERIAL_PORT)
   using namespace boost::asio;
 
   try
@@ -82,6 +83,7 @@
   catch (std::exception&)
   {
   }
+#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT)
 }
 
 } // namespace serial_port_base_compile

Modified: branches/release/libs/asio/test/ssl/stream.cpp
==============================================================================
--- branches/release/libs/asio/test/ssl/stream.cpp (original)
+++ branches/release/libs/asio/test/ssl/stream.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -75,6 +75,11 @@
       = stream1.lowest_layer();
     (void)lowest_layer;
 
+ const ssl::stream<ip::tcp::socket>& stream3 = stream1;
+ const ssl::stream<ip::tcp::socket>::lowest_layer_type& lowest_layer2
+ = stream3.lowest_layer();
+ (void)lowest_layer2;
+
     stream1.handshake(ssl::stream_base::client);
     stream1.handshake(ssl::stream_base::server);
     stream1.handshake(ssl::stream_base::client, ec);

Modified: branches/release/libs/asio/test/windows/random_access_handle.cpp
==============================================================================
--- branches/release/libs/asio/test/windows/random_access_handle.cpp (original)
+++ branches/release/libs/asio/test/windows/random_access_handle.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -68,6 +68,11 @@
       = handle1.lowest_layer();
     (void)lowest_layer;
 
+ const win::random_access_handle& handle3 = handle1;
+ const win::random_access_handle::lowest_layer_type& lowest_layer2
+ = handle3.lowest_layer();
+ (void)lowest_layer2;
+
     HANDLE native_handle2 = INVALID_HANDLE_VALUE;
     handle1.assign(native_handle2);
 

Modified: branches/release/libs/asio/test/windows/stream_handle.cpp
==============================================================================
--- branches/release/libs/asio/test/windows/stream_handle.cpp (original)
+++ branches/release/libs/asio/test/windows/stream_handle.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -67,6 +67,11 @@
       = handle1.lowest_layer();
     (void)lowest_layer;
 
+ const win::stream_handle& handle3 = handle1;
+ const win::stream_handle::lowest_layer_type& lowest_layer2
+ = handle3.lowest_layer();
+ (void)lowest_layer2;
+
     HANDLE native_handle2 = INVALID_HANDLE_VALUE;
     handle1.assign(native_handle2);
 

Modified: branches/release/libs/asio/test/write.cpp
==============================================================================
--- branches/release/libs/asio/test/write.cpp (original)
+++ branches/release/libs/asio/test/write.cpp 2008-10-09 01:41:50 EDT (Thu, 09 Oct 2008)
@@ -39,7 +39,7 @@
     memset(data_, 0, max_length);
   }
 
- io_service_type& io_service()
+ io_service_type& get_io_service()
   {
     return io_service_;
   }
@@ -159,6 +159,18 @@
   BOOST_CHECK(s.check(buffers, sizeof(write_data)));
 }
 
+bool old_style_transfer_all(const boost::system::error_code& ec,
+ size_t bytes_transferred)
+{
+ return !!ec;
+}
+
+size_t short_transfer(const boost::system::error_code& ec,
+ size_t bytes_transferred)
+{
+ return !!ec ? 0 : 3;
+}
+
 void test_3_arg_write()
 {
   boost::asio::io_service ios;
@@ -245,6 +257,40 @@
       boost::asio::transfer_at_least(42));
   BOOST_CHECK(bytes_transferred == 50);
   BOOST_CHECK(s.check(buffers, 50));
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
 }
 
 void test_4_arg_write()
@@ -357,6 +403,53 @@
   BOOST_CHECK(bytes_transferred == 50);
   BOOST_CHECK(s.check(buffers, 50));
   BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ old_style_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::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ old_style_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::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers, short_transfer, 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::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers, short_transfer, 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::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers, short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
 }
 
 void async_write_handler(const boost::system::error_code& e,
@@ -571,6 +664,82 @@
   ios.run();
   BOOST_CHECK(called);
   BOOST_CHECK(s.check(buffers, 50));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write(s, buffers, old_style_transfer_all,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, old_style_transfer_all,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, old_style_transfer_all,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write(s, buffers, short_transfer,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, short_transfer,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, short_transfer,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check(buffers, sizeof(write_data)));
 }
 
 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