diff options
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp | 71 |
1 files changed, 47 insertions, 24 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp index 0180435..aeaf4f4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2014 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) @@ -17,13 +17,14 @@ #include <boost/asio/detail/config.hpp> -#if !defined(BOOST_ASIO_HAS_IOCP) +#if !defined(BOOST_ASIO_HAS_IOCP) \ + && !defined(BOOST_ASIO_WINDOWS_RUNTIME) -#include <boost/utility/addressof.hpp> #include <boost/asio/buffer.hpp> #include <boost/asio/error.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/socket_base.hpp> +#include <boost/asio/detail/addressof.hpp> #include <boost/asio/detail/buffer_sequence_adapter.hpp> #include <boost/asio/detail/reactive_null_buffers_op.hpp> #include <boost/asio/detail/reactive_socket_recv_op.hpp> @@ -198,18 +199,21 @@ public: template <typename ConstBufferSequence, typename Handler> void async_send(base_implementation_type& impl, const ConstBufferSequence& buffers, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) { + bool is_continuation = + boost_asio_handler_cont_helpers::is_continuation(handler); + // Allocate and construct an operation to wrap the handler. typedef reactive_socket_send_op<ConstBufferSequence, Handler> op; - typename op::ptr p = { boost::addressof(handler), + typename op::ptr p = { boost::asio::detail::addressof(handler), boost_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, buffers, flags, handler); BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send")); - start_op(impl, reactor::write_op, p.p, true, + start_op(impl, reactor::write_op, p.p, is_continuation, true, ((impl.state_ & socket_ops::stream_oriented) && buffer_sequence_adapter<boost::asio::const_buffer, ConstBufferSequence>::all_empty(buffers))); @@ -219,11 +223,14 @@ public: // Start an asynchronous wait until data can be sent without blocking. template <typename Handler> void async_send(base_implementation_type& impl, const null_buffers&, - socket_base::message_flags, Handler handler) + socket_base::message_flags, Handler& handler) { + bool is_continuation = + boost_asio_handler_cont_helpers::is_continuation(handler); + // Allocate and construct an operation to wrap the handler. typedef reactive_null_buffers_op<Handler> op; - typename op::ptr p = { boost::addressof(handler), + typename op::ptr p = { boost::asio::detail::addressof(handler), boost_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); @@ -231,7 +238,7 @@ public: BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send(null_buffers)")); - start_op(impl, reactor::write_op, p.p, false, false); + start_op(impl, reactor::write_op, p.p, is_continuation, false, false); p.v = p.p = 0; } @@ -263,11 +270,14 @@ public: template <typename MutableBufferSequence, typename Handler> void async_receive(base_implementation_type& impl, const MutableBufferSequence& buffers, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) { + bool is_continuation = + boost_asio_handler_cont_helpers::is_continuation(handler); + // Allocate and construct an operation to wrap the handler. typedef reactive_socket_recv_op<MutableBufferSequence, Handler> op; - typename op::ptr p = { boost::addressof(handler), + typename op::ptr p = { boost::asio::detail::addressof(handler), boost_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, impl.state_, buffers, flags, handler); @@ -277,7 +287,8 @@ public: start_op(impl, (flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, - p.p, (flags & socket_base::message_out_of_band) == 0, + p.p, is_continuation, + (flags & socket_base::message_out_of_band) == 0, ((impl.state_ & socket_ops::stream_oriented) && buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence>::all_empty(buffers))); @@ -287,11 +298,14 @@ public: // Wait until data can be received without blocking. template <typename Handler> void async_receive(base_implementation_type& impl, const null_buffers&, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) { + bool is_continuation = + boost_asio_handler_cont_helpers::is_continuation(handler); + // Allocate and construct an operation to wrap the handler. typedef reactive_null_buffers_op<Handler> op; - typename op::ptr p = { boost::addressof(handler), + typename op::ptr p = { boost::asio::detail::addressof(handler), boost_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); @@ -302,7 +316,7 @@ public: start_op(impl, (flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, - p.p, false, false); + p.p, is_continuation, false, false); p.v = p.p = 0; } @@ -341,11 +355,14 @@ public: template <typename MutableBufferSequence, typename Handler> void async_receive_with_flags(base_implementation_type& impl, const MutableBufferSequence& buffers, socket_base::message_flags in_flags, - socket_base::message_flags& out_flags, Handler handler) + socket_base::message_flags& out_flags, Handler& handler) { + bool is_continuation = + boost_asio_handler_cont_helpers::is_continuation(handler); + // Allocate and construct an operation to wrap the handler. typedef reactive_socket_recvmsg_op<MutableBufferSequence, Handler> op; - typename op::ptr p = { boost::addressof(handler), + typename op::ptr p = { boost::asio::detail::addressof(handler), boost_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, buffers, in_flags, out_flags, handler); @@ -356,7 +373,8 @@ public: start_op(impl, (in_flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, - p.p, (in_flags & socket_base::message_out_of_band) == 0, false); + p.p, is_continuation, + (in_flags & socket_base::message_out_of_band) == 0, false); p.v = p.p = 0; } @@ -364,11 +382,14 @@ public: template <typename Handler> void async_receive_with_flags(base_implementation_type& impl, const null_buffers&, socket_base::message_flags in_flags, - socket_base::message_flags& out_flags, Handler handler) + socket_base::message_flags& out_flags, Handler& handler) { + bool is_continuation = + boost_asio_handler_cont_helpers::is_continuation(handler); + // Allocate and construct an operation to wrap the handler. typedef reactive_null_buffers_op<Handler> op; - typename op::ptr p = { boost::addressof(handler), + typename op::ptr p = { boost::asio::detail::addressof(handler), boost_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); @@ -383,7 +404,7 @@ public: start_op(impl, (in_flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, - p.p, false, false); + p.p, is_continuation, false, false); p.v = p.p = 0; } @@ -400,15 +421,16 @@ protected: // Start the asynchronous read or write operation. BOOST_ASIO_DECL void start_op(base_implementation_type& impl, int op_type, - reactor_op* op, bool is_non_blocking, bool noop); + reactor_op* op, bool is_continuation, bool is_non_blocking, bool noop); // Start the asynchronous accept operation. BOOST_ASIO_DECL void start_accept_op(base_implementation_type& impl, - reactor_op* op, bool peer_is_open); + reactor_op* op, bool is_continuation, bool peer_is_open); // Start the asynchronous connect operation. BOOST_ASIO_DECL void start_connect_op(base_implementation_type& impl, - reactor_op* op, const socket_addr_type* addr, size_t addrlen); + reactor_op* op, bool is_continuation, + const socket_addr_type* addr, size_t addrlen); // The selector that performs event demultiplexing for the service. reactor& reactor_; @@ -425,5 +447,6 @@ protected: #endif // defined(BOOST_ASIO_HEADER_ONLY) #endif // !defined(BOOST_ASIO_HAS_IOCP) + // && !defined(BOOST_ASIO_WINDOWS_RUNTIME) #endif // BOOST_ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_BASE_HPP |