summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-10-19 20:22:58 (GMT)
committerTobias Markmann <tm@ayena.de>2014-10-20 13:49:33 (GMT)
commit6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch)
tree2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp
parent38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff)
downloadswift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip
swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0. Updated our update.sh script to stop on error. Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to missing include of <iostream> with newer Boost. Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp')
-rw-r--r--3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp99
1 files changed, 80 insertions, 19 deletions
diff --git a/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp b/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp
index 5a3b0f7..ed019a0 100644
--- a/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp
+++ b/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp
@@ -2,7 +2,7 @@
// basic_socket_acceptor.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)
@@ -20,6 +20,7 @@
#include <boost/asio/basic_socket.hpp>
#include <boost/asio/detail/handler_type_requirements.hpp>
#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/socket_acceptor_service.hpp>
#include <boost/asio/socket_base.hpp>
@@ -211,6 +212,54 @@ public:
BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(other));
return *this;
}
+
+ // All socket acceptors have access to each other's implementations.
+ template <typename Protocol1, typename SocketAcceptorService1>
+ friend class basic_socket_acceptor;
+
+ /// Move-construct a basic_socket_acceptor from an acceptor of another
+ /// protocol type.
+ /**
+ * This constructor moves an acceptor from one object to another.
+ *
+ * @param other The other basic_socket_acceptor object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_socket(io_service&) constructor.
+ */
+ template <typename Protocol1, typename SocketAcceptorService1>
+ basic_socket_acceptor(
+ basic_socket_acceptor<Protocol1, SocketAcceptorService1>&& other,
+ typename enable_if<is_convertible<Protocol1, Protocol>::value>::type* = 0)
+ : basic_io_object<SocketAcceptorService>(other.get_io_service())
+ {
+ this->get_service().template converting_move_construct<Protocol1>(
+ this->get_implementation(), other.get_implementation());
+ }
+
+ /// Move-assign a basic_socket_acceptor from an acceptor of another protocol
+ /// type.
+ /**
+ * This assignment operator moves an acceptor from one object to another.
+ *
+ * @param other The other basic_socket_acceptor object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_socket(io_service&) constructor.
+ */
+ template <typename Protocol1, typename SocketAcceptorService1>
+ typename enable_if<is_convertible<Protocol1, Protocol>::value,
+ basic_socket_acceptor>::type& operator=(
+ basic_socket_acceptor<Protocol1, SocketAcceptorService1>&& other)
+ {
+ basic_socket_acceptor tmp(BOOST_ASIO_MOVE_CAST2(basic_socket_acceptor<
+ Protocol1, SocketAcceptorService1>)(other));
+ basic_io_object<SocketAcceptorService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(tmp));
+ return *this;
+ }
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Open the acceptor using the specified protocol.
@@ -316,8 +365,9 @@ public:
* @par Example
* @code
* boost::asio::ip::tcp::acceptor acceptor(io_service);
- * acceptor.open(boost::asio::ip::tcp::v4());
- * acceptor.bind(boost::asio::ip::tcp::endpoint(12345));
+ * boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345);
+ * acceptor.open(endpoint.protocol());
+ * acceptor.bind(endpoint);
* @endcode
*/
void bind(const endpoint_type& endpoint)
@@ -340,9 +390,10 @@ public:
* @par Example
* @code
* boost::asio::ip::tcp::acceptor acceptor(io_service);
- * acceptor.open(boost::asio::ip::tcp::v4());
+ * boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 12345);
+ * acceptor.open(endpoint.protocol());
* boost::system::error_code ec;
- * acceptor.bind(boost::asio::ip::tcp::endpoint(12345), ec);
+ * acceptor.bind(endpoint, ec);
* if (ec)
* {
* // An error occurred.
@@ -871,11 +922,13 @@ public:
* acceptor.accept(socket);
* @endcode
*/
- template <typename SocketService>
- void accept(basic_socket<protocol_type, SocketService>& peer)
+ template <typename Protocol1, typename SocketService>
+ void accept(basic_socket<Protocol1, SocketService>& peer,
+ typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0)
{
boost::system::error_code ec;
- this->get_service().accept(this->get_implementation(), peer, 0, ec);
+ this->get_service().accept(this->get_implementation(),
+ peer, static_cast<endpoint_type*>(0), ec);
boost::asio::detail::throw_error(ec, "accept");
}
@@ -902,12 +955,14 @@ public:
* }
* @endcode
*/
- template <typename SocketService>
+ template <typename Protocol1, typename SocketService>
boost::system::error_code accept(
- basic_socket<protocol_type, SocketService>& peer,
- boost::system::error_code& ec)
+ basic_socket<Protocol1, SocketService>& peer,
+ boost::system::error_code& ec,
+ typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0)
{
- return this->get_service().accept(this->get_implementation(), peer, 0, ec);
+ return this->get_service().accept(this->get_implementation(),
+ peer, static_cast<endpoint_type*>(0), ec);
}
/// Start an asynchronous accept.
@@ -948,16 +1003,20 @@ public:
* acceptor.async_accept(socket, accept_handler);
* @endcode
*/
- template <typename SocketService, typename AcceptHandler>
- void async_accept(basic_socket<protocol_type, SocketService>& peer,
- BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
+ template <typename Protocol1, typename SocketService, typename AcceptHandler>
+ BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler,
+ void (boost::system::error_code))
+ async_accept(basic_socket<Protocol1, SocketService>& peer,
+ BOOST_ASIO_MOVE_ARG(AcceptHandler) handler,
+ typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0)
{
// If you get an error on the following line it means that your handler does
// not meet the documented type requirements for a AcceptHandler.
BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check;
- this->get_service().async_accept(this->get_implementation(),
- peer, 0, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
+ return this->get_service().async_accept(this->get_implementation(),
+ peer, static_cast<endpoint_type*>(0),
+ BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
}
/// Accept a new connection and obtain the endpoint of the peer
@@ -1057,14 +1116,16 @@ public:
* boost::asio::io_service::post().
*/
template <typename SocketService, typename AcceptHandler>
- void async_accept(basic_socket<protocol_type, SocketService>& peer,
+ BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler,
+ void (boost::system::error_code))
+ async_accept(basic_socket<protocol_type, SocketService>& peer,
endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
{
// If you get an error on the following line it means that your handler does
// not meet the documented type requirements for a AcceptHandler.
BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check;
- this->get_service().async_accept(this->get_implementation(), peer,
+ return this->get_service().async_accept(this->get_implementation(), peer,
&peer_endpoint, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
}
};