Revert "externals: Update boost to 1.72 and add Boost Context"

This commit is contained in:
bunnei 2020-02-22 00:33:06 -05:00 committed by GitHub
parent 8b4b26a2fd
commit faaf93d90b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
618 changed files with 14262 additions and 96298 deletions

View file

@ -81,14 +81,6 @@ public:
/// The type of the executor associated with the object.
typedef Executor executor_type;
/// Rebinds the acceptor type to another executor.
template <typename Executor1>
struct rebind_executor
{
/// The socket type when rebound to the specified executor.
typedef basic_socket_acceptor<Protocol, Executor1> other;
};
/// The native representation of an acceptor.
#if defined(GENERATING_DOCUMENTATION)
typedef implementation_defined native_handle_type;
@ -1219,17 +1211,13 @@ public:
* wait_handler);
* @endcode
*/
template <
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code))
WaitHandler BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WaitHandler,
template <typename WaitHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler,
void (boost::system::error_code))
async_wait(wait_type w,
BOOST_ASIO_MOVE_ARG(WaitHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
async_wait(wait_type w, BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
{
return async_initiate<WaitHandler, void (boost::system::error_code)>(
initiate_async_wait(this), handler, w);
initiate_async_wait(), handler, this, w);
}
#if !defined(BOOST_ASIO_NO_EXTENSIONS)
@ -1336,20 +1324,17 @@ public:
* acceptor.async_accept(socket, accept_handler);
* @endcode
*/
template <typename Protocol1, typename Executor1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code))
AcceptHandler BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(AcceptHandler,
template <typename Protocol1, typename Executor1, typename AcceptHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler,
void (boost::system::error_code))
async_accept(basic_socket<Protocol1, Executor1>& peer,
BOOST_ASIO_MOVE_ARG(AcceptHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
BOOST_ASIO_MOVE_ARG(AcceptHandler) handler,
typename enable_if<
is_convertible<Protocol, Protocol1>::value
>::type* = 0)
{
return async_initiate<AcceptHandler, void (boost::system::error_code)>(
initiate_async_accept(this), handler,
initiate_async_accept(), handler, this,
&peer, static_cast<endpoint_type*>(0));
}
@ -1449,18 +1434,14 @@ public:
* immediate completion, invocation of the handler will be performed in a
* manner equivalent to using boost::asio::post().
*/
template <typename Executor1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code))
AcceptHandler BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(AcceptHandler,
template <typename Executor1, typename AcceptHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler,
void (boost::system::error_code))
async_accept(basic_socket<protocol_type, Executor1>& peer,
endpoint_type& peer_endpoint,
BOOST_ASIO_MOVE_ARG(AcceptHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
{
return async_initiate<AcceptHandler, void (boost::system::error_code)>(
initiate_async_accept(this), handler, &peer, &peer_endpoint);
initiate_async_accept(), handler, this, &peer, &peer_endpoint);
}
#endif // !defined(BOOST_ASIO_NO_EXTENSIONS)
@ -1485,12 +1466,10 @@ public:
* boost::asio::ip::tcp::socket socket(acceptor.accept());
* @endcode
*/
typename Protocol::socket::template rebind_executor<executor_type>::other
accept()
typename Protocol::socket accept()
{
boost::system::error_code ec;
typename Protocol::socket::template rebind_executor<
executor_type>::other peer(impl_.get_executor());
typename Protocol::socket peer(impl_.get_executor());
impl_.get_service().accept(impl_.get_implementation(), peer, 0, ec);
boost::asio::detail::throw_error(ec, "accept");
return peer;
@ -1521,11 +1500,9 @@ public:
* }
* @endcode
*/
typename Protocol::socket::template rebind_executor<executor_type>::other
accept(boost::system::error_code& ec)
typename Protocol::socket accept(boost::system::error_code& ec)
{
typename Protocol::socket::template rebind_executor<
executor_type>::other peer(impl_.get_executor());
typename Protocol::socket peer(impl_.get_executor());
impl_.get_service().accept(impl_.get_implementation(), peer, 0, ec);
return peer;
}
@ -1542,11 +1519,8 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* // Result of operation.
* const boost::system::error_code& error,
* // On success, the newly accepted socket.
* typename Protocol::socket::template
* rebind_executor<executor_type>::other peer
* const boost::system::error_code& error, // Result of operation.
* typename Protocol::socket peer // On success, the newly accepted socket.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. On
@ -1571,26 +1545,16 @@ public:
* acceptor.async_accept(accept_handler);
* @endcode
*/
template <
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
executor_type>::other)) MoveAcceptHandler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
void (boost::system::error_code,
typename Protocol::socket::template
rebind_executor<executor_type>::other))
async_accept(
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
template <typename MoveAcceptHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
void (boost::system::error_code, typename Protocol::socket))
async_accept(BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler)
{
return async_initiate<MoveAcceptHandler,
void (boost::system::error_code, typename Protocol::socket::template
rebind_executor<executor_type>::other)>(
initiate_async_move_accept(this), handler,
impl_.get_executor(), static_cast<endpoint_type*>(0),
static_cast<typename Protocol::socket::template
rebind_executor<executor_type>::other*>(0));
void (boost::system::error_code, typename Protocol::socket)>(
initiate_async_move_accept(), handler, this,
impl_.get_executor(), static_cast<endpoint_type*>(0),
static_cast<typename Protocol::socket*>(0));
}
/// Accept a new connection.
@ -1795,18 +1759,13 @@ public:
* acceptor.async_accept(my_context2, accept_handler);
* @endcode
*/
template <typename Executor1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
Executor1>::other)) MoveAcceptHandler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
template <typename Executor1, typename MoveAcceptHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
Executor1>::other))
async_accept(const Executor1& ex,
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler,
typename enable_if<
is_executor<Executor1>::value
>::type* = 0)
@ -1816,7 +1775,7 @@ public:
return async_initiate<MoveAcceptHandler,
void (boost::system::error_code, other_socket_type)>(
initiate_async_move_accept(this), handler,
initiate_async_move_accept(), handler, this,
ex, static_cast<endpoint_type*>(0),
static_cast<other_socket_type*>(0));
}
@ -1864,18 +1823,13 @@ public:
* acceptor.async_accept(my_context2, accept_handler);
* @endcode
*/
template <typename ExecutionContext,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
typename ExecutionContext::executor_type>::other)) MoveAcceptHandler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
template <typename ExecutionContext, typename MoveAcceptHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
typename ExecutionContext::executor_type>::other))
async_accept(ExecutionContext& context,
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler,
typename enable_if<
is_convertible<ExecutionContext&, execution_context&>::value
>::type* = 0)
@ -1885,7 +1839,7 @@ public:
return async_initiate<MoveAcceptHandler,
void (boost::system::error_code, other_socket_type)>(
initiate_async_move_accept(this), handler,
initiate_async_move_accept(), handler, this,
context.get_executor(), static_cast<endpoint_type*>(0),
static_cast<other_socket_type*>(0));
}
@ -1914,12 +1868,10 @@ public:
* boost::asio::ip::tcp::socket socket(acceptor.accept(endpoint));
* @endcode
*/
typename Protocol::socket::template rebind_executor<executor_type>::other
accept(endpoint_type& peer_endpoint)
typename Protocol::socket accept(endpoint_type& peer_endpoint)
{
boost::system::error_code ec;
typename Protocol::socket::template rebind_executor<
executor_type>::other peer(impl_.get_executor());
typename Protocol::socket peer(impl_.get_executor());
impl_.get_service().accept(impl_.get_implementation(),
peer, &peer_endpoint, ec);
boost::asio::detail::throw_error(ec, "accept");
@ -1955,11 +1907,10 @@ public:
* }
* @endcode
*/
typename Protocol::socket::template rebind_executor<executor_type>::other
accept(endpoint_type& peer_endpoint, boost::system::error_code& ec)
typename Protocol::socket accept(
endpoint_type& peer_endpoint, boost::system::error_code& ec)
{
typename Protocol::socket::template rebind_executor<
executor_type>::other peer(impl_.get_executor());
typename Protocol::socket peer(impl_.get_executor());
impl_.get_service().accept(impl_.get_implementation(),
peer, &peer_endpoint, ec);
return peer;
@ -1982,11 +1933,8 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* // Result of operation.
* const boost::system::error_code& error,
* // On success, the newly accepted socket.
* typename Protocol::socket::template
* rebind_executor<executor_type>::other peer
* const boost::system::error_code& error, // Result of operation.
* typename Protocol::socket peer // On success, the newly accepted socket.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. On
@ -2012,26 +1960,17 @@ public:
* acceptor.async_accept(endpoint, accept_handler);
* @endcode
*/
template <
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
executor_type>::other)) MoveAcceptHandler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
void (boost::system::error_code,
typename Protocol::socket::template
rebind_executor<executor_type>::other))
template <typename MoveAcceptHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
void (boost::system::error_code, typename Protocol::socket))
async_accept(endpoint_type& peer_endpoint,
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler)
{
return async_initiate<MoveAcceptHandler,
void (boost::system::error_code, typename Protocol::socket::template
rebind_executor<executor_type>::other)>(
initiate_async_move_accept(this), handler,
impl_.get_executor(), &peer_endpoint,
static_cast<typename Protocol::socket::template
rebind_executor<executor_type>::other*>(0));
void (boost::system::error_code, typename Protocol::socket)>(
initiate_async_move_accept(), handler, this,
impl_.get_executor(), &peer_endpoint,
static_cast<typename Protocol::socket*>(0));
}
/// Accept a new connection.
@ -2268,18 +2207,13 @@ public:
* acceptor.async_accept(my_context2, endpoint, accept_handler);
* @endcode
*/
template <typename Executor1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
Executor1>::other)) MoveAcceptHandler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
template <typename Executor1, typename MoveAcceptHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
Executor1>::other))
async_accept(const Executor1& ex, endpoint_type& peer_endpoint,
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler,
typename enable_if<
is_executor<Executor1>::value
>::type* = 0)
@ -2289,7 +2223,7 @@ public:
return async_initiate<MoveAcceptHandler,
void (boost::system::error_code, other_socket_type)>(
initiate_async_move_accept(this), handler,
initiate_async_move_accept(), handler, this,
ex, &peer_endpoint,
static_cast<other_socket_type*>(0));
}
@ -2343,19 +2277,14 @@ public:
* acceptor.async_accept(my_context2, endpoint, accept_handler);
* @endcode
*/
template <typename ExecutionContext,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
typename ExecutionContext::executor_type>::other)) MoveAcceptHandler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
template <typename ExecutionContext, typename MoveAcceptHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
typename ExecutionContext::executor_type>::other))
async_accept(ExecutionContext& context,
endpoint_type& peer_endpoint,
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler,
typename enable_if<
is_convertible<ExecutionContext&, execution_context&>::value
>::type* = 0)
@ -2365,7 +2294,7 @@ public:
return async_initiate<MoveAcceptHandler,
void (boost::system::error_code, other_socket_type)>(
initiate_async_move_accept(this), handler,
initiate_async_move_accept(), handler, this,
context.get_executor(), &peer_endpoint,
static_cast<other_socket_type*>(0));
}
@ -2377,56 +2306,28 @@ private:
basic_socket_acceptor& operator=(
const basic_socket_acceptor&) BOOST_ASIO_DELETED;
class initiate_async_wait
struct initiate_async_wait
{
public:
typedef Executor executor_type;
explicit initiate_async_wait(basic_socket_acceptor* self)
: self_(self)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
template <typename WaitHandler>
void operator()(BOOST_ASIO_MOVE_ARG(WaitHandler) handler, wait_type w) const
void operator()(BOOST_ASIO_MOVE_ARG(WaitHandler) handler,
basic_socket_acceptor* self, wait_type w) const
{
// If you get an error on the following line it means that your handler
// does not meet the documented type requirements for a WaitHandler.
BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
detail::non_const_lvalue<WaitHandler> handler2(handler);
self_->impl_.get_service().async_wait(
self_->impl_.get_implementation(), w, handler2.value,
self_->impl_.get_implementation_executor());
self->impl_.get_service().async_wait(
self->impl_.get_implementation(), w, handler2.value,
self->impl_.get_implementation_executor());
}
private:
basic_socket_acceptor* self_;
};
class initiate_async_accept
struct initiate_async_accept
{
public:
typedef Executor executor_type;
explicit initiate_async_accept(basic_socket_acceptor* self)
: self_(self)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
template <typename AcceptHandler, typename Protocol1, typename Executor1>
void operator()(BOOST_ASIO_MOVE_ARG(AcceptHandler) handler,
basic_socket<Protocol1, Executor1>* peer,
basic_socket_acceptor* self, basic_socket<Protocol1, Executor1>* peer,
endpoint_type* peer_endpoint) const
{
// If you get an error on the following line it means that your handler
@ -2434,33 +2335,18 @@ private:
BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check;
detail::non_const_lvalue<AcceptHandler> handler2(handler);
self_->impl_.get_service().async_accept(
self_->impl_.get_implementation(), *peer, peer_endpoint,
handler2.value, self_->impl_.get_implementation_executor());
self->impl_.get_service().async_accept(
self->impl_.get_implementation(), *peer, peer_endpoint,
handler2.value, self->impl_.get_implementation_executor());
}
private:
basic_socket_acceptor* self_;
};
class initiate_async_move_accept
struct initiate_async_move_accept
{
public:
typedef Executor executor_type;
explicit initiate_async_move_accept(basic_socket_acceptor* self)
: self_(self)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
template <typename MoveAcceptHandler, typename Executor1, typename Socket>
void operator()(BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler,
const Executor1& peer_ex, endpoint_type* peer_endpoint, Socket*) const
basic_socket_acceptor* self, const Executor1& peer_ex,
endpoint_type* peer_endpoint, Socket*) const
{
// If you get an error on the following line it means that your handler
// does not meet the documented type requirements for a MoveAcceptHandler.
@ -2468,13 +2354,10 @@ private:
MoveAcceptHandler, handler, Socket) type_check;
detail::non_const_lvalue<MoveAcceptHandler> handler2(handler);
self_->impl_.get_service().async_move_accept(
self_->impl_.get_implementation(), peer_ex, peer_endpoint,
handler2.value, self_->impl_.get_implementation_executor());
self->impl_.get_service().async_move_accept(
self->impl_.get_implementation(), peer_ex, peer_endpoint,
handler2.value, self->impl_.get_implementation_executor());
}
private:
basic_socket_acceptor* self_;
};
#if defined(BOOST_ASIO_WINDOWS_RUNTIME)