summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-05-06 17:44:27 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-05-06 17:44:27 (GMT)
commitd76ada0ab59634e3333f9eb5a92d0e850f60d7bf (patch)
tree5eaae441173fad2ec19ba67d6589f28ecd740991 /3rdParty/Boost/src/boost/asio/impl
parent6f49e5abee37d37b351d68c01374232eccdac458 (diff)
downloadswift-contrib-d76ada0ab59634e3333f9eb5a92d0e850f60d7bf.zip
swift-contrib-d76ada0ab59634e3333f9eb5a92d0e850f60d7bf.tar.bz2
Updated Boost to 1.43.0.
Diffstat (limited to '3rdParty/Boost/src/boost/asio/impl')
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/io_service.ipp12
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/read.ipp202
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/read_at.ipp8
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/write.ipp180
-rw-r--r--3rdParty/Boost/src/boost/asio/impl/write_at.ipp8
5 files changed, 273 insertions, 137 deletions
diff --git a/3rdParty/Boost/src/boost/asio/impl/io_service.ipp b/3rdParty/Boost/src/boost/asio/impl/io_service.ipp
index 9234dc4..20f868d 100644
--- a/3rdParty/Boost/src/boost/asio/impl/io_service.ipp
+++ b/3rdParty/Boost/src/boost/asio/impl/io_service.ipp
@@ -26,18 +26,9 @@
#if defined(BOOST_ASIO_HAS_IOCP)
# include <boost/asio/detail/win_iocp_io_service.hpp>
-#elif defined(BOOST_ASIO_HAS_EPOLL)
-# include <boost/asio/detail/epoll_reactor.hpp>
-# include <boost/asio/detail/task_io_service.hpp>
-#elif defined(BOOST_ASIO_HAS_KQUEUE)
-# include <boost/asio/detail/kqueue_reactor.hpp>
-# include <boost/asio/detail/task_io_service.hpp>
-#elif defined(BOOST_ASIO_HAS_DEV_POLL)
-# include <boost/asio/detail/dev_poll_reactor.hpp>
-# include <boost/asio/detail/task_io_service.hpp>
#else
-# include <boost/asio/detail/select_reactor.hpp>
# include <boost/asio/detail/task_io_service.hpp>
+# include <boost/asio/detail/reactor.hpp>
#endif
namespace boost {
@@ -176,7 +167,6 @@ inline boost::asio::io_service& io_service::work::get_io_service()
inline io_service::service::service(boost::asio::io_service& owner)
: owner_(owner),
- type_info_(0),
next_(0)
{
}
diff --git a/3rdParty/Boost/src/boost/asio/impl/read.ipp b/3rdParty/Boost/src/boost/asio/impl/read.ipp
index 05ea960..772c06b 100644
--- a/3rdParty/Boost/src/boost/asio/impl/read.ipp
+++ b/3rdParty/Boost/src/boost/asio/impl/read.ipp
@@ -24,6 +24,7 @@
#include <boost/asio/buffer.hpp>
#include <boost/asio/completion_condition.hpp>
#include <boost/asio/error.hpp>
+#include <boost/asio/detail/base_from_completion_cond.hpp>
#include <boost/asio/detail/bind_handler.hpp>
#include <boost/asio/detail/consuming_buffers.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
@@ -42,14 +43,14 @@ std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
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(
+ tmp.prepare(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;
- tmp.set_max_size(detail::adapt_completion_condition_result(
+ tmp.prepare(detail::adapt_completion_condition_result(
completion_condition(ec, total_transferred)));
}
return total_transferred;
@@ -130,51 +131,111 @@ namespace detail
{
template <typename AsyncReadStream, typename MutableBufferSequence,
typename CompletionCondition, typename ReadHandler>
- class read_handler
+ class read_op
+ : detail::base_from_completion_cond<CompletionCondition>
{
public:
- typedef boost::asio::detail::consuming_buffers<
- mutable_buffer, MutableBufferSequence> buffers_type;
-
- read_handler(AsyncReadStream& stream, const buffers_type& buffers,
+ read_op(AsyncReadStream& stream, const MutableBufferSequence& buffers,
CompletionCondition completion_condition, ReadHandler handler)
- : stream_(stream),
+ : detail::base_from_completion_cond<
+ CompletionCondition>(completion_condition),
+ stream_(stream),
buffers_(buffers),
total_transferred_(0),
- completion_condition_(completion_condition),
- handler_(handler)
+ handler_(handler),
+ start_(true)
{
}
void operator()(const boost::system::error_code& ec,
std::size_t bytes_transferred)
{
- total_transferred_ += bytes_transferred;
- buffers_.consume(bytes_transferred);
- buffers_.set_max_size(detail::adapt_completion_condition_result(
- completion_condition_(ec, total_transferred_)));
- if (buffers_.begin() == buffers_.end())
+ switch (start_)
{
+ case true: start_ = false;
+ buffers_.prepare(this->check(ec, total_transferred_));
+ for (;;)
+ {
+ stream_.async_read_some(buffers_, *this);
+ return; default:
+ total_transferred_ += bytes_transferred;
+ buffers_.consume(bytes_transferred);
+ buffers_.prepare(this->check(ec, total_transferred_));
+ if ((!ec && bytes_transferred == 0)
+ || buffers_.begin() == buffers_.end())
+ break;
+ }
+
handler_(ec, total_transferred_);
}
- else
+ }
+
+ //private:
+ AsyncReadStream& stream_;
+ boost::asio::detail::consuming_buffers<
+ mutable_buffer, MutableBufferSequence> buffers_;
+ std::size_t total_transferred_;
+ ReadHandler handler_;
+ bool start_;
+ };
+
+ template <typename AsyncReadStream,
+ typename CompletionCondition, typename ReadHandler>
+ class read_op<AsyncReadStream, boost::asio::mutable_buffers_1,
+ CompletionCondition, ReadHandler>
+ : detail::base_from_completion_cond<CompletionCondition>
+ {
+ public:
+ read_op(AsyncReadStream& stream,
+ const boost::asio::mutable_buffers_1& buffers,
+ CompletionCondition completion_condition,
+ ReadHandler handler)
+ : detail::base_from_completion_cond<
+ CompletionCondition>(completion_condition),
+ stream_(stream),
+ buffer_(buffers),
+ total_transferred_(0),
+ handler_(handler),
+ start_(true)
+ {
+ }
+
+ void operator()(const boost::system::error_code& ec,
+ std::size_t bytes_transferred)
+ {
+ std::size_t n = 0;
+ switch (start_)
{
- stream_.async_read_some(buffers_, *this);
+ case true: start_ = false;
+ n = this->check(ec, total_transferred_);
+ for (;;)
+ {
+ stream_.async_read_some(boost::asio::buffer(
+ buffer_ + total_transferred_, n), *this);
+ return; default:
+ total_transferred_ += bytes_transferred;
+ if ((!ec && bytes_transferred == 0)
+ || (n = this->check(ec, total_transferred_)) == 0
+ || total_transferred_ == boost::asio::buffer_size(buffer_))
+ break;
+ }
+
+ handler_(ec, total_transferred_);
}
}
//private:
AsyncReadStream& stream_;
- buffers_type buffers_;
+ boost::asio::mutable_buffer buffer_;
std::size_t total_transferred_;
- CompletionCondition completion_condition_;
ReadHandler handler_;
+ bool start_;
};
template <typename AsyncReadStream, typename MutableBufferSequence,
typename CompletionCondition, typename ReadHandler>
inline void* asio_handler_allocate(std::size_t size,
- read_handler<AsyncReadStream, MutableBufferSequence,
+ read_op<AsyncReadStream, MutableBufferSequence,
CompletionCondition, ReadHandler>* this_handler)
{
return boost_asio_handler_alloc_helpers::allocate(
@@ -184,7 +245,7 @@ namespace detail
template <typename AsyncReadStream, typename MutableBufferSequence,
typename CompletionCondition, typename ReadHandler>
inline void asio_handler_deallocate(void* pointer, std::size_t size,
- read_handler<AsyncReadStream, MutableBufferSequence,
+ read_op<AsyncReadStream, MutableBufferSequence,
CompletionCondition, ReadHandler>* this_handler)
{
boost_asio_handler_alloc_helpers::deallocate(
@@ -195,7 +256,7 @@ namespace detail
typename MutableBufferSequence, typename CompletionCondition,
typename ReadHandler>
inline void asio_handler_invoke(const Function& function,
- read_handler<AsyncReadStream, MutableBufferSequence,
+ read_op<AsyncReadStream, MutableBufferSequence,
CompletionCondition, ReadHandler>* this_handler)
{
boost_asio_handler_invoke_helpers::invoke(
@@ -208,24 +269,10 @@ template <typename AsyncReadStream, typename MutableBufferSequence,
inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
CompletionCondition completion_condition, ReadHandler handler)
{
- 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>(
- s, tmp, completion_condition, handler));
+ detail::read_op<AsyncReadStream, MutableBufferSequence,
+ CompletionCondition, ReadHandler>(
+ s, buffers, completion_condition, handler)(
+ boost::system::error_code(), 0);
}
template <typename AsyncReadStream, typename MutableBufferSequence,
@@ -242,52 +289,64 @@ namespace detail
{
template <typename AsyncReadStream, typename Allocator,
typename CompletionCondition, typename ReadHandler>
- class read_streambuf_handler
+ class read_streambuf_op
+ : detail::base_from_completion_cond<CompletionCondition>
{
public:
- read_streambuf_handler(AsyncReadStream& stream,
+ read_streambuf_op(AsyncReadStream& stream,
basic_streambuf<Allocator>& streambuf,
CompletionCondition completion_condition, ReadHandler handler)
- : stream_(stream),
+ : detail::base_from_completion_cond<
+ CompletionCondition>(completion_condition),
+ stream_(stream),
streambuf_(streambuf),
total_transferred_(0),
- completion_condition_(completion_condition),
- handler_(handler)
+ handler_(handler),
+ start_(true)
{
}
void operator()(const boost::system::error_code& ec,
std::size_t bytes_transferred)
{
- total_transferred_ += bytes_transferred;
- streambuf_.commit(bytes_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)
+ std::size_t max_size, bytes_available;
+ switch (start_)
{
+ case true: start_ = false;
+ max_size = this->check(ec, total_transferred_);
+ bytes_available = std::min<std::size_t>(512,
+ std::min<std::size_t>(max_size,
+ streambuf_.max_size() - streambuf_.size()));
+ for (;;)
+ {
+ stream_.async_read_some(streambuf_.prepare(bytes_available), *this);
+ return; default:
+ total_transferred_ += bytes_transferred;
+ streambuf_.commit(bytes_transferred);
+ max_size = this->check(ec, total_transferred_);
+ bytes_available = std::min<std::size_t>(512,
+ std::min<std::size_t>(max_size,
+ streambuf_.max_size() - streambuf_.size()));
+ if ((!ec && bytes_transferred == 0) || bytes_available == 0)
+ break;
+ }
+
handler_(ec, total_transferred_);
}
- else
- {
- stream_.async_read_some(streambuf_.prepare(bytes_available), *this);
- }
}
//private:
AsyncReadStream& stream_;
boost::asio::basic_streambuf<Allocator>& streambuf_;
std::size_t total_transferred_;
- CompletionCondition completion_condition_;
ReadHandler handler_;
+ bool start_;
};
template <typename AsyncReadStream, typename Allocator,
typename CompletionCondition, typename ReadHandler>
inline void* asio_handler_allocate(std::size_t size,
- read_streambuf_handler<AsyncReadStream, Allocator,
+ read_streambuf_op<AsyncReadStream, Allocator,
CompletionCondition, ReadHandler>* this_handler)
{
return boost_asio_handler_alloc_helpers::allocate(
@@ -297,7 +356,7 @@ namespace detail
template <typename AsyncReadStream, typename Allocator,
typename CompletionCondition, typename ReadHandler>
inline void asio_handler_deallocate(void* pointer, std::size_t size,
- read_streambuf_handler<AsyncReadStream, Allocator,
+ read_streambuf_op<AsyncReadStream, Allocator,
CompletionCondition, ReadHandler>* this_handler)
{
boost_asio_handler_alloc_helpers::deallocate(
@@ -307,7 +366,7 @@ namespace detail
template <typename Function, typename AsyncReadStream,
typename Allocator, typename CompletionCondition, typename ReadHandler>
inline void asio_handler_invoke(const Function& function,
- read_streambuf_handler<AsyncReadStream, Allocator,
+ read_streambuf_op<AsyncReadStream, Allocator,
CompletionCondition, ReadHandler>* this_handler)
{
boost_asio_handler_invoke_helpers::invoke(
@@ -321,23 +380,10 @@ inline void async_read(AsyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b,
CompletionCondition completion_condition, ReadHandler handler)
{
- 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>(
- s, b, completion_condition, handler));
+ detail::read_streambuf_op<AsyncReadStream,
+ Allocator, CompletionCondition, ReadHandler>(
+ s, b, completion_condition, handler)(
+ boost::system::error_code(), 0);
}
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
diff --git a/3rdParty/Boost/src/boost/asio/impl/read_at.ipp b/3rdParty/Boost/src/boost/asio/impl/read_at.ipp
index 91fd014..eb3c3f8 100644
--- a/3rdParty/Boost/src/boost/asio/impl/read_at.ipp
+++ b/3rdParty/Boost/src/boost/asio/impl/read_at.ipp
@@ -43,7 +43,7 @@ std::size_t read_at(SyncRandomAccessReadDevice& d,
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(
+ tmp.prepare(detail::adapt_completion_condition_result(
completion_condition(ec, total_transferred)));
while (tmp.begin() != tmp.end())
{
@@ -51,7 +51,7 @@ std::size_t read_at(SyncRandomAccessReadDevice& d,
offset + total_transferred, tmp, ec);
tmp.consume(bytes_transferred);
total_transferred += bytes_transferred;
- tmp.set_max_size(detail::adapt_completion_condition_result(
+ tmp.prepare(detail::adapt_completion_condition_result(
completion_condition(ec, total_transferred)));
}
return total_transferred;
@@ -158,7 +158,7 @@ namespace detail
{
total_transferred_ += bytes_transferred;
buffers_.consume(bytes_transferred);
- buffers_.set_max_size(detail::adapt_completion_condition_result(
+ buffers_.prepare(detail::adapt_completion_condition_result(
completion_condition_(ec, total_transferred_)));
if (buffers_.begin() == buffers_.end())
{
@@ -225,7 +225,7 @@ inline void async_read_at(AsyncRandomAccessReadDevice& d,
boost::system::error_code ec;
std::size_t total_transferred = 0;
- tmp.set_max_size(detail::adapt_completion_condition_result(
+ tmp.prepare(detail::adapt_completion_condition_result(
completion_condition(ec, total_transferred)));
if (tmp.begin() == tmp.end())
{
diff --git a/3rdParty/Boost/src/boost/asio/impl/write.ipp b/3rdParty/Boost/src/boost/asio/impl/write.ipp
index 76bace3..28a5273 100644
--- a/3rdParty/Boost/src/boost/asio/impl/write.ipp
+++ b/3rdParty/Boost/src/boost/asio/impl/write.ipp
@@ -19,6 +19,7 @@
#include <boost/asio/buffer.hpp>
#include <boost/asio/completion_condition.hpp>
+#include <boost/asio/detail/base_from_completion_cond.hpp>
#include <boost/asio/detail/bind_handler.hpp>
#include <boost/asio/detail/consuming_buffers.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
@@ -37,14 +38,14 @@ std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
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(
+ tmp.prepare(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;
- tmp.set_max_size(detail::adapt_completion_condition_result(
+ tmp.prepare(detail::adapt_completion_condition_result(
completion_condition(ec, total_transferred)));
}
return total_transferred;
@@ -111,51 +112,164 @@ namespace detail
{
template <typename AsyncWriteStream, typename ConstBufferSequence,
typename CompletionCondition, typename WriteHandler>
- class write_handler
+ class write_op
+ : detail::base_from_completion_cond<CompletionCondition>
{
public:
- typedef boost::asio::detail::consuming_buffers<
- const_buffer, ConstBufferSequence> buffers_type;
-
- write_handler(AsyncWriteStream& stream, const buffers_type& buffers,
+ write_op(AsyncWriteStream& stream, const ConstBufferSequence& buffers,
CompletionCondition completion_condition, WriteHandler handler)
- : stream_(stream),
+ : detail::base_from_completion_cond<
+ CompletionCondition>(completion_condition),
+ stream_(stream),
buffers_(buffers),
total_transferred_(0),
- completion_condition_(completion_condition),
- handler_(handler)
+ handler_(handler),
+ start_(true)
+ {
+ }
+
+ void operator()(const boost::system::error_code& ec,
+ std::size_t bytes_transferred)
+ {
+ switch (start_)
+ {
+ case true: start_ = false;
+ buffers_.prepare(this->check(ec, total_transferred_));
+ for (;;)
+ {
+ stream_.async_write_some(buffers_, *this);
+ return; default:
+ total_transferred_ += bytes_transferred;
+ buffers_.consume(bytes_transferred);
+ buffers_.prepare(this->check(ec, total_transferred_));
+ if ((!ec && bytes_transferred == 0)
+ || buffers_.begin() == buffers_.end())
+ break;
+ }
+
+ handler_(ec, total_transferred_);
+ }
+ }
+
+ //private:
+ AsyncWriteStream& stream_;
+ boost::asio::detail::consuming_buffers<
+ const_buffer, ConstBufferSequence> buffers_;
+ std::size_t total_transferred_;
+ WriteHandler handler_;
+ bool start_;
+ };
+
+ template <typename AsyncWriteStream,
+ typename CompletionCondition, typename WriteHandler>
+ class write_op<AsyncWriteStream, boost::asio::mutable_buffers_1,
+ CompletionCondition, WriteHandler>
+ : detail::base_from_completion_cond<CompletionCondition>
+ {
+ public:
+ write_op(AsyncWriteStream& stream,
+ const boost::asio::mutable_buffers_1& buffers,
+ CompletionCondition completion_condition,
+ WriteHandler handler)
+ : detail::base_from_completion_cond<
+ CompletionCondition>(completion_condition),
+ stream_(stream),
+ buffer_(buffers),
+ total_transferred_(0),
+ handler_(handler),
+ start_(true)
{
}
void operator()(const boost::system::error_code& ec,
std::size_t bytes_transferred)
{
- total_transferred_ += bytes_transferred;
- buffers_.consume(bytes_transferred);
- buffers_.set_max_size(detail::adapt_completion_condition_result(
- completion_condition_(ec, total_transferred_)));
- if (buffers_.begin() == buffers_.end())
+ std::size_t n = 0;
+ switch (start_)
{
+ case true: start_ = false;
+ n = this->check(ec, total_transferred_);
+ for (;;)
+ {
+ stream_.async_write_some(boost::asio::buffer(
+ buffer_ + total_transferred_, n), *this);
+ return; default:
+ total_transferred_ += bytes_transferred;
+ if ((!ec && bytes_transferred == 0)
+ || (n = this->check(ec, total_transferred_)) == 0
+ || total_transferred_ == boost::asio::buffer_size(buffer_))
+ break;
+ }
+
handler_(ec, total_transferred_);
}
- else
+ }
+
+ //private:
+ AsyncWriteStream& stream_;
+ boost::asio::mutable_buffer buffer_;
+ std::size_t total_transferred_;
+ WriteHandler handler_;
+ bool start_;
+ };
+
+ template <typename AsyncWriteStream,
+ typename CompletionCondition, typename WriteHandler>
+ class write_op<AsyncWriteStream, boost::asio::const_buffers_1,
+ CompletionCondition, WriteHandler>
+ : detail::base_from_completion_cond<CompletionCondition>
+ {
+ public:
+ write_op(AsyncWriteStream& stream,
+ const boost::asio::const_buffers_1& buffers,
+ CompletionCondition completion_condition,
+ WriteHandler handler)
+ : detail::base_from_completion_cond<
+ CompletionCondition>(completion_condition),
+ stream_(stream),
+ buffer_(buffers),
+ total_transferred_(0),
+ handler_(handler),
+ start_(true)
+ {
+ }
+
+ void operator()(const boost::system::error_code& ec,
+ std::size_t bytes_transferred)
+ {
+ std::size_t n = 0;
+ switch (start_)
{
- stream_.async_write_some(buffers_, *this);
+ case true: start_ = false;
+ n = this->check(ec, total_transferred_);
+ for (;;)
+ {
+ stream_.async_write_some(boost::asio::buffer(
+ buffer_ + total_transferred_, n), *this);
+ return; default:
+ total_transferred_ += bytes_transferred;
+ if ((!ec && bytes_transferred == 0)
+ || (n = this->check(ec, total_transferred_)) == 0
+ || total_transferred_ == boost::asio::buffer_size(buffer_))
+ break;
+ }
+
+ handler_(ec, total_transferred_);
}
}
//private:
AsyncWriteStream& stream_;
- buffers_type buffers_;
+ boost::asio::const_buffer buffer_;
std::size_t total_transferred_;
- CompletionCondition completion_condition_;
WriteHandler handler_;
+ bool start_;
};
template <typename AsyncWriteStream, typename ConstBufferSequence,
typename CompletionCondition, typename WriteHandler>
inline void* asio_handler_allocate(std::size_t size,
- write_handler<AsyncWriteStream, ConstBufferSequence,
+ write_op<AsyncWriteStream, ConstBufferSequence,
CompletionCondition, WriteHandler>* this_handler)
{
return boost_asio_handler_alloc_helpers::allocate(
@@ -165,7 +279,7 @@ namespace detail
template <typename AsyncWriteStream, typename ConstBufferSequence,
typename CompletionCondition, typename WriteHandler>
inline void asio_handler_deallocate(void* pointer, std::size_t size,
- write_handler<AsyncWriteStream, ConstBufferSequence,
+ write_op<AsyncWriteStream, ConstBufferSequence,
CompletionCondition, WriteHandler>* this_handler)
{
boost_asio_handler_alloc_helpers::deallocate(
@@ -176,7 +290,7 @@ namespace detail
typename ConstBufferSequence, typename CompletionCondition,
typename WriteHandler>
inline void asio_handler_invoke(const Function& function,
- write_handler<AsyncWriteStream, ConstBufferSequence,
+ write_op<AsyncWriteStream, ConstBufferSequence,
CompletionCondition, WriteHandler>* this_handler)
{
boost_asio_handler_invoke_helpers::invoke(
@@ -189,24 +303,10 @@ template <typename AsyncWriteStream, typename ConstBufferSequence,
inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
CompletionCondition completion_condition, WriteHandler handler)
{
- 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>(
- s, tmp, completion_condition, handler));
+ detail::write_op<AsyncWriteStream, ConstBufferSequence,
+ CompletionCondition, WriteHandler>(
+ s, buffers, completion_condition, handler)(
+ boost::system::error_code(), 0);
}
template <typename AsyncWriteStream, typename ConstBufferSequence,
diff --git a/3rdParty/Boost/src/boost/asio/impl/write_at.ipp b/3rdParty/Boost/src/boost/asio/impl/write_at.ipp
index 751229b..3d1a112 100644
--- a/3rdParty/Boost/src/boost/asio/impl/write_at.ipp
+++ b/3rdParty/Boost/src/boost/asio/impl/write_at.ipp
@@ -38,7 +38,7 @@ std::size_t write_at(SyncRandomAccessWriteDevice& d,
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(
+ tmp.prepare(detail::adapt_completion_condition_result(
completion_condition(ec, total_transferred)));
while (tmp.begin() != tmp.end())
{
@@ -46,7 +46,7 @@ std::size_t write_at(SyncRandomAccessWriteDevice& d,
offset + total_transferred, tmp, ec);
tmp.consume(bytes_transferred);
total_transferred += bytes_transferred;
- tmp.set_max_size(detail::adapt_completion_condition_result(
+ tmp.prepare(detail::adapt_completion_condition_result(
completion_condition(ec, total_transferred)));
}
return total_transferred;
@@ -142,7 +142,7 @@ namespace detail
{
total_transferred_ += bytes_transferred;
buffers_.consume(bytes_transferred);
- buffers_.set_max_size(detail::adapt_completion_condition_result(
+ buffers_.prepare(detail::adapt_completion_condition_result(
completion_condition_(ec, total_transferred_)));
if (buffers_.begin() == buffers_.end())
{
@@ -207,7 +207,7 @@ inline void async_write_at(AsyncRandomAccessWriteDevice& d,
boost::system::error_code ec;
std::size_t total_transferred = 0;
- tmp.set_max_size(detail::adapt_completion_condition_result(
+ tmp.prepare(detail::adapt_completion_condition_result(
completion_condition(ec, total_transferred)));
if (tmp.begin() == tmp.end())
{