summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-04-11 18:19:17 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-04-11 19:20:07 (GMT)
commit857e44c156a1dbefcb49bb5792c4384cebd8762a (patch)
tree11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp
parent77d4eb7588e113beaa03f3347523b26adefdeb06 (diff)
downloadswift-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip
swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp')
-rw-r--r--3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp47
1 files changed, 44 insertions, 3 deletions
diff --git a/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp b/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp
index 1d06541..fb38b25 100644
--- a/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp
+++ b/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp
@@ -2,7 +2,7 @@
// buffered_write_stream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -21,7 +21,7 @@
#include <cstddef>
#include <cstring>
#include <boost/config.hpp>
-#include <boost/type_traits.hpp>
+#include <boost/type_traits/remove_reference.hpp>
#include <boost/asio/detail/pop_options.hpp>
#include <boost/asio/buffered_write_stream_fwd.hpp>
@@ -187,8 +187,21 @@ public:
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers)
{
+ typename ConstBufferSequence::const_iterator iter = buffers.begin();
+ typename ConstBufferSequence::const_iterator end = buffers.end();
+ size_t total_buffer_size = 0;
+ for (; iter != end; ++iter)
+ {
+ boost::asio::const_buffer buffer(*iter);
+ total_buffer_size += boost::asio::buffer_size(buffer);
+ }
+
+ if (total_buffer_size == 0)
+ return 0;
+
if (storage_.size() == storage_.capacity())
flush();
+
return copy(buffers);
}
@@ -199,8 +212,22 @@ public:
boost::system::error_code& ec)
{
ec = boost::system::error_code();
+
+ typename ConstBufferSequence::const_iterator iter = buffers.begin();
+ typename ConstBufferSequence::const_iterator end = buffers.end();
+ size_t total_buffer_size = 0;
+ for (; iter != end; ++iter)
+ {
+ boost::asio::const_buffer buffer(*iter);
+ total_buffer_size += boost::asio::buffer_size(buffer);
+ }
+
+ if (total_buffer_size == 0)
+ return 0;
+
if (storage_.size() == storage_.capacity() && !flush(ec))
return 0;
+
return copy(buffers);
}
@@ -264,7 +291,21 @@ public:
void async_write_some(const ConstBufferSequence& buffers,
WriteHandler handler)
{
- if (storage_.size() == storage_.capacity())
+ typename ConstBufferSequence::const_iterator iter = buffers.begin();
+ typename ConstBufferSequence::const_iterator end = buffers.end();
+ size_t total_buffer_size = 0;
+ for (; iter != end; ++iter)
+ {
+ boost::asio::const_buffer buffer(*iter);
+ total_buffer_size += boost::asio::buffer_size(buffer);
+ }
+
+ if (total_buffer_size == 0)
+ {
+ get_io_service().post(detail::bind_handler(
+ handler, boost::system::error_code(), 0));
+ }
+ else if (storage_.size() == storage_.capacity())
{
async_flush(write_some_handler<ConstBufferSequence, WriteHandler>(
get_io_service(), storage_, buffers, handler));