Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72807 - trunk/boost/asio/ssl/detail/impl
From: chris_at_[hidden]
Date: 2011-06-29 19:35:18


Author: chris_kohlhoff
Date: 2011-06-29 19:35:17 EDT (Wed, 29 Jun 2011)
New Revision: 72807
URL: http://svn.boost.org/trac/boost/changeset/72807

Log:
Zero-length reads and writes need to complete immediately.
Text files modified:
   trunk/boost/asio/ssl/detail/impl/engine.ipp | 12 ++++++++++++
   1 files changed, 12 insertions(+), 0 deletions(-)

Modified: trunk/boost/asio/ssl/detail/impl/engine.ipp
==============================================================================
--- trunk/boost/asio/ssl/detail/impl/engine.ipp (original)
+++ trunk/boost/asio/ssl/detail/impl/engine.ipp 2011-06-29 19:35:17 EDT (Wed, 29 Jun 2011)
@@ -126,6 +126,12 @@
 engine::want engine::write(const boost::asio::const_buffer& data,
     boost::system::error_code& ec, std::size_t& bytes_transferred)
 {
+ if (boost::asio::buffer_size(data) == 0)
+ {
+ ec = boost::system::error_code();
+ return engine::want_nothing;
+ }
+
   return perform(&engine::do_write,
       const_cast<void*>(boost::asio::buffer_cast<const void*>(data)),
       boost::asio::buffer_size(data), ec, &bytes_transferred);
@@ -134,6 +140,12 @@
 engine::want engine::read(const boost::asio::mutable_buffer& data,
     boost::system::error_code& ec, std::size_t& bytes_transferred)
 {
+ if (boost::asio::buffer_size(data) == 0)
+ {
+ ec = boost::system::error_code();
+ return engine::want_nothing;
+ }
+
   return perform(&engine::do_read,
       boost::asio::buffer_cast<void*>(data),
       boost::asio::buffer_size(data), ec, &bytes_transferred);


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