New async_result with two template parameters.
This change makes async_result consistent with the networking TS. The older single-parameter form of async_result, and the handler_type trait, have been deprecated. They have been retained for backwards compatibility, and existing specialisations of these traits will still be used. However, asynchronous operations that use the older form of async_result/handler_type will not interoperate with completion tokens that specialize only the new two-parameter async_result. For this reason, the completion token types implemented by asio continue to provide specialisations of the older form of async_result and handler_type.
This commit is contained in:
parent
428ec47e43
commit
7a46efd8bf
@ -24,11 +24,94 @@
|
||||
namespace asio {
|
||||
|
||||
/// An interface for customising the behaviour of an initiating function.
|
||||
/**
|
||||
* The async_result traits class is used for determining:
|
||||
*
|
||||
* @li the concrete completion handler type to be called at the end of the
|
||||
* asynchronous operation;
|
||||
*
|
||||
* @li the initiating function return type; and
|
||||
*
|
||||
* @li how the return value of the initiating function is obtained.
|
||||
*
|
||||
* The trait allows the handler and return types to be determined at the point
|
||||
* where the specific completion handler signature is known.
|
||||
*
|
||||
* This template may be specialised for user-defined completion token types.
|
||||
* The primary template assumes that the CompletionToken is the completion
|
||||
* handler.
|
||||
*/
|
||||
#if defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
template <typename CompletionToken, typename Signature>
|
||||
#else // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
template <typename CompletionToken, typename Signature = void>
|
||||
#endif // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
class async_result
|
||||
{
|
||||
public:
|
||||
#if defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
/// The concrete completion handler type for the specific signature.
|
||||
typedef CompletionToken completion_handler_type;
|
||||
|
||||
/// The return type of the initiating function.
|
||||
typedef void return_type;
|
||||
#else // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
// For backward compatibility, determine the concrete completion handler type
|
||||
// by using the legacy handler_type trait.
|
||||
typedef typename handler_type<CompletionToken, Signature>::type
|
||||
completion_handler_type;
|
||||
|
||||
// For backward compatibility, determine the initiating function return type
|
||||
// using the legacy single-parameter version of async_result.
|
||||
typedef typename async_result<completion_handler_type>::type return_type;
|
||||
#endif // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// Construct an async result from a given handler.
|
||||
/**
|
||||
* When using a specalised async_result, the constructor has an opportunity
|
||||
* to initialise some state associated with the completion handler, which is
|
||||
* then returned from the initiating function.
|
||||
*/
|
||||
explicit async_result(completion_handler_type& h)
|
||||
#if defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
// No data members to initialise.
|
||||
#else // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
: legacy_result_(h)
|
||||
#endif // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
(void)h;
|
||||
}
|
||||
|
||||
/// Obtain the value to be returned from the initiating function.
|
||||
return_type get()
|
||||
{
|
||||
#if defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
// Nothing to do.
|
||||
#else // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
return legacy_result_.get();
|
||||
#endif // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
}
|
||||
|
||||
private:
|
||||
async_result(const async_result&) ASIO_DELETED;
|
||||
async_result& operator=(const async_result&) ASIO_DELETED;
|
||||
|
||||
#if defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
// No data members.
|
||||
#else // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
async_result<completion_handler_type> legacy_result_;
|
||||
#endif // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
|
||||
};
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
/// (Deprecated: Use two-parameter version of async_result.) An interface for
|
||||
/// customising the behaviour of an initiating function.
|
||||
/**
|
||||
* This template may be specialised for user-defined handler types.
|
||||
*/
|
||||
template <typename Handler>
|
||||
class async_result
|
||||
class async_result<Handler>
|
||||
{
|
||||
public:
|
||||
/// The return type of the initiating function.
|
||||
@ -50,33 +133,42 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// Helper template to deduce the real type of a handler, capture a local copy
|
||||
/// of the handler, and then create an async_result for the handler.
|
||||
template <typename Handler, typename Signature>
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
/// Helper template to deduce the handler type from a CompletionToken, capture
|
||||
/// a local copy of the handler, and then create an async_result for the
|
||||
/// handler.
|
||||
template <typename CompletionToken, typename Signature>
|
||||
struct async_completion
|
||||
{
|
||||
/// The real handler type to be used for the asynchronous operation.
|
||||
typedef typename asio::handler_type<
|
||||
Handler, Signature>::type handler_type;
|
||||
typedef typename asio::async_result<
|
||||
typename decay<CompletionToken>::type,
|
||||
Signature>::completion_handler_type completion_handler_type;
|
||||
|
||||
#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||
/// Constructor.
|
||||
/**
|
||||
* The constructor creates the concrete handler and makes the link between
|
||||
* the handler and the asynchronous result.
|
||||
* The constructor creates the concrete completion handler and makes the link
|
||||
* between the handler and the asynchronous result.
|
||||
*/
|
||||
#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||
explicit async_completion(
|
||||
Handler& orig_handler)
|
||||
: handler(static_cast<typename conditional<
|
||||
is_same<Handler, handler_type>::value,
|
||||
handler_type&, Handler&&>::type>(orig_handler)),
|
||||
result(handler)
|
||||
explicit async_completion(CompletionToken& token)
|
||||
: completion_handler(static_cast<typename conditional<
|
||||
is_same<CompletionToken, completion_handler_type>::value,
|
||||
completion_handler_type&, CompletionToken&&>::type>(token)),
|
||||
result(completion_handler)
|
||||
{
|
||||
}
|
||||
#else // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||
explicit async_completion(const Handler& orig_handler)
|
||||
: handler(orig_handler),
|
||||
result(handler)
|
||||
explicit async_completion(typename decay<CompletionToken>::type& token)
|
||||
: completion_handler(token),
|
||||
result(completion_handler)
|
||||
{
|
||||
}
|
||||
|
||||
explicit async_completion(const typename decay<CompletionToken>::type& token)
|
||||
: completion_handler(token),
|
||||
result(completion_handler)
|
||||
{
|
||||
}
|
||||
#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||
@ -84,25 +176,22 @@ struct async_completion
|
||||
/// A copy of, or reference to, a real handler object.
|
||||
#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||
typename conditional<
|
||||
is_same<Handler, handler_type>::value,
|
||||
handler_type&, handler_type>::type handler;
|
||||
is_same<CompletionToken, completion_handler_type>::value,
|
||||
completion_handler_type&, completion_handler_type>::type completion_handler;
|
||||
#else // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||
typename asio::handler_type<Handler, Signature>::type handler;
|
||||
completion_handler_type completion_handler;
|
||||
#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// The result of the asynchronous operation's initiating function.
|
||||
async_result<typename asio::handler_type<
|
||||
Handler, Signature>::type> result;
|
||||
async_result<typename decay<CompletionToken>::type, Signature> result;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename Handler, typename Signature>
|
||||
struct async_result_type_helper
|
||||
template <typename CompletionToken, typename Signature>
|
||||
struct async_result_helper
|
||||
: async_result<typename decay<CompletionToken>::type, Signature>
|
||||
{
|
||||
typedef typename async_result<
|
||||
typename handler_type<Handler, Signature>::type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
@ -111,15 +200,22 @@ struct async_result_type_helper
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
# define ASIO_INITFN_RESULT_TYPE(h, sig) \
|
||||
# define ASIO_INITFN_RESULT_TYPE(ct, sig) \
|
||||
void_or_deduced
|
||||
#elif defined(_MSC_VER) && (_MSC_VER < 1500)
|
||||
# define ASIO_INITFN_RESULT_TYPE(h, sig) \
|
||||
typename ::asio::detail::async_result_type_helper<h, sig>::type
|
||||
# define ASIO_INITFN_RESULT_TYPE(ct, sig) \
|
||||
typename ::asio::detail::async_result_helper< \
|
||||
ct, sig>::return_type
|
||||
#define ASIO_HANDLER_TYPE(ct, sig) \
|
||||
typename ::asio::detail::async_result_helper< \
|
||||
ct, sig>::completion_handler_type
|
||||
#else
|
||||
# define ASIO_INITFN_RESULT_TYPE(h, sig) \
|
||||
# define ASIO_INITFN_RESULT_TYPE(ct, sig) \
|
||||
typename ::asio::async_result< \
|
||||
typename ::asio::handler_type<h, sig>::type>::type
|
||||
typename ::asio::decay<ct>::type, sig>::return_type
|
||||
#define ASIO_HANDLER_TYPE(ct, sig) \
|
||||
typename ::asio::async_result< \
|
||||
typename ::asio::decay<ct>::type, sig>::completion_handler_type
|
||||
#endif
|
||||
|
||||
#endif // ASIO_ASYNC_RESULT_HPP
|
||||
|
@ -354,7 +354,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_send(this->get_implementation(),
|
||||
buffers, 0, init.handler);
|
||||
buffers, 0, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -407,7 +407,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_send(this->get_implementation(),
|
||||
buffers, flags, init.handler);
|
||||
buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -559,7 +559,7 @@ public:
|
||||
|
||||
this->get_service().async_send_to(
|
||||
this->get_implementation(), buffers, destination, 0,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -613,7 +613,7 @@ public:
|
||||
|
||||
this->get_service().async_send_to(
|
||||
this->get_implementation(), buffers, destination, flags,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -762,7 +762,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_receive(this->get_implementation(),
|
||||
buffers, 0, init.handler);
|
||||
buffers, 0, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -815,7 +815,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_receive(this->get_implementation(),
|
||||
buffers, flags, init.handler);
|
||||
buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -967,7 +967,7 @@ public:
|
||||
|
||||
this->get_service().async_receive_from(
|
||||
this->get_implementation(), buffers, sender_endpoint, 0,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -1023,7 +1023,7 @@ public:
|
||||
|
||||
this->get_service().async_receive_from(
|
||||
this->get_implementation(), buffers, sender_endpoint, flags,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
|
@ -571,7 +571,8 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
this->get_service().async_wait(this->get_implementation(), init.handler);
|
||||
this->get_service().async_wait(this->get_implementation(),
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
|
@ -346,7 +346,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_send(this->get_implementation(),
|
||||
buffers, 0, init.handler);
|
||||
buffers, 0, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -399,7 +399,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_send(this->get_implementation(),
|
||||
buffers, flags, init.handler);
|
||||
buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -549,7 +549,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_send_to(this->get_implementation(),
|
||||
buffers, destination, 0, init.handler);
|
||||
buffers, destination, 0, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -603,7 +603,7 @@ public:
|
||||
|
||||
this->get_service().async_send_to(
|
||||
this->get_implementation(), buffers, destination, flags,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -752,7 +752,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_receive(this->get_implementation(),
|
||||
buffers, 0, init.handler);
|
||||
buffers, 0, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -805,7 +805,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_receive(this->get_implementation(),
|
||||
buffers, flags, init.handler);
|
||||
buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -957,7 +957,7 @@ public:
|
||||
|
||||
this->get_service().async_receive_from(
|
||||
this->get_implementation(), buffers, sender_endpoint, 0,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -1013,7 +1013,7 @@ public:
|
||||
|
||||
this->get_service().async_receive_from(
|
||||
this->get_implementation(), buffers, sender_endpoint, flags,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
|
@ -332,7 +332,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_send(this->get_implementation(),
|
||||
buffers, flags, init.handler);
|
||||
buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -531,7 +531,7 @@ public:
|
||||
|
||||
this->get_service().async_receive_with_flags(
|
||||
this->get_implementation(), buffers, 0, out_flags,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -601,7 +601,7 @@ public:
|
||||
|
||||
this->get_service().async_receive_with_flags(
|
||||
this->get_implementation(), buffers, in_flags, out_flags,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
|
@ -812,7 +812,7 @@ public:
|
||||
asio::detail::bind_handler(
|
||||
ASIO_MOVE_CAST(ASIO_HANDLER_TYPE(
|
||||
ConnectHandler, void (asio::error_code)))(
|
||||
init.handler), ec));
|
||||
init.completion_handler), ec));
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -826,7 +826,7 @@ public:
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
this->get_service().async_connect(
|
||||
this->get_implementation(), peer_endpoint, init.handler);
|
||||
this->get_implementation(), peer_endpoint, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -1658,7 +1658,8 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
this->get_service().async_wait(this->get_implementation(), w, init.handler);
|
||||
this->get_service().async_wait(this->get_implementation(),
|
||||
w, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
|
@ -1060,7 +1060,8 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
this->get_service().async_wait(this->get_implementation(), w, init.handler);
|
||||
this->get_service().async_wait(this->get_implementation(),
|
||||
w, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -1207,7 +1208,7 @@ public:
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
this->get_service().async_accept(this->get_implementation(),
|
||||
peer, static_cast<endpoint_type*>(0), init.handler);
|
||||
peer, static_cast<endpoint_type*>(0), init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -1344,7 +1345,7 @@ public:
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
this->get_service().async_accept(this->get_implementation(),
|
||||
peer, &peer_endpoint, init.handler);
|
||||
peer, &peer_endpoint, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -1471,7 +1472,7 @@ public:
|
||||
|
||||
this->get_service().async_accept(
|
||||
this->get_implementation(), static_cast<asio::io_context*>(0),
|
||||
static_cast<endpoint_type*>(0), init.handler);
|
||||
static_cast<endpoint_type*>(0), init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -1607,7 +1608,7 @@ public:
|
||||
typename Protocol::socket)> init(handler);
|
||||
|
||||
this->get_service().async_accept(this->get_implementation(),
|
||||
&io_context, static_cast<endpoint_type*>(0), init.handler);
|
||||
&io_context, static_cast<endpoint_type*>(0), init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -1748,7 +1749,8 @@ public:
|
||||
typename Protocol::socket)> init(handler);
|
||||
|
||||
this->get_service().async_accept(this->get_implementation(),
|
||||
static_cast<asio::io_context*>(0), &peer_endpoint, init.handler);
|
||||
static_cast<asio::io_context*>(0), &peer_endpoint,
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -1902,7 +1904,7 @@ public:
|
||||
typename Protocol::socket)> init(handler);
|
||||
|
||||
this->get_service().async_accept(this->get_implementation(),
|
||||
&io_context, &peer_endpoint, init.handler);
|
||||
&io_context, &peer_endpoint, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
|
@ -368,7 +368,7 @@ public:
|
||||
|
||||
this->get_service().async_send(
|
||||
this->get_implementation(), buffers, 0,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -432,7 +432,7 @@ public:
|
||||
|
||||
this->get_service().async_send(
|
||||
this->get_implementation(), buffers, flags,
|
||||
init.handler);
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -598,7 +598,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_receive(this->get_implementation(),
|
||||
buffers, 0, init.handler);
|
||||
buffers, 0, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -662,7 +662,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_receive(this->get_implementation(),
|
||||
buffers, flags, init.handler);
|
||||
buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -781,7 +781,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_send(this->get_implementation(),
|
||||
buffers, 0, init.handler);
|
||||
buffers, 0, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -904,7 +904,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_receive(this->get_implementation(),
|
||||
buffers, 0, init.handler);
|
||||
buffers, 0, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
|
@ -670,7 +670,8 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
this->get_service().async_wait(this->get_implementation(), init.handler);
|
||||
this->get_service().async_wait(this->get_implementation(),
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "asio/detail/variadic_templates.hpp"
|
||||
#include "asio/associated_allocator.hpp"
|
||||
#include "asio/async_result.hpp"
|
||||
#include "asio/handler_type.hpp"
|
||||
#include "asio/is_executor.hpp"
|
||||
#include "asio/uses_executor.hpp"
|
||||
|
||||
@ -519,6 +518,35 @@ template <typename T, typename Executor>
|
||||
struct uses_executor<executor_binder<T, Executor>, Executor>
|
||||
: true_type {};
|
||||
|
||||
template <typename T, typename Executor, typename Signature>
|
||||
class async_result<executor_binder<T, Executor>, Signature>
|
||||
{
|
||||
public:
|
||||
typedef executor_binder<
|
||||
typename async_result<T, Signature>::completion_handler_type, Executor>
|
||||
completion_handler_type;
|
||||
|
||||
typedef typename async_result<T, Signature>::return_type return_type;
|
||||
|
||||
explicit async_result(executor_binder<T, Executor>& b)
|
||||
: target_(b.get())
|
||||
{
|
||||
}
|
||||
|
||||
return_type get()
|
||||
{
|
||||
return target_.get();
|
||||
}
|
||||
|
||||
private:
|
||||
async_result(const async_result&) ASIO_DELETED;
|
||||
async_result& operator=(const async_result&) ASIO_DELETED;
|
||||
|
||||
async_result<T, Signature> target_;
|
||||
};
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
template <typename T, typename Executor, typename Signature>
|
||||
struct handler_type<executor_binder<T, Executor>, Signature>
|
||||
{
|
||||
@ -546,6 +574,8 @@ private:
|
||||
async_result<T> target_;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
template <typename T, typename Executor, typename Allocator>
|
||||
struct associated_allocator<executor_binder<T, Executor>, Allocator>
|
||||
{
|
||||
|
@ -163,7 +163,8 @@ public:
|
||||
|
||||
next_layer_.async_write_some(buffers,
|
||||
ASIO_MOVE_CAST(ASIO_HANDLER_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t)))(init.handler));
|
||||
void (asio::error_code, std::size_t)))(
|
||||
init.completion_handler));
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -198,7 +198,8 @@ public:
|
||||
|
||||
next_layer_.async_read_some(buffers,
|
||||
ASIO_MOVE_CAST(ASIO_HANDLER_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t)))(init.handler));
|
||||
void (asio::error_code, std::size_t)))(
|
||||
init.completion_handler));
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public:
|
||||
async_completion<ConnectHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_connect(impl, peer_endpoint, init.handler);
|
||||
service_impl_.async_connect(impl, peer_endpoint, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -312,7 +312,7 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_wait(impl, w, init.handler);
|
||||
service_impl_.async_wait(impl, w, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -337,7 +337,7 @@ public:
|
||||
async_completion<WriteHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_send(impl, buffers, flags, init.handler);
|
||||
service_impl_.async_send(impl, buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -364,7 +364,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_send_to(impl, buffers,
|
||||
destination, flags, init.handler);
|
||||
destination, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -390,7 +390,7 @@ public:
|
||||
async_completion<ReadHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_receive(impl, buffers, flags, init.handler);
|
||||
service_impl_.async_receive(impl, buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -418,7 +418,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_receive_from(impl, buffers,
|
||||
sender_endpoint, flags, init.handler);
|
||||
sender_endpoint, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_wait(impl, init.handler);
|
||||
service_impl_.async_wait(impl, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -50,7 +50,7 @@
|
||||
#endif // !defined(ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
|
||||
|
||||
#if defined(ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
|
||||
# include "asio/handler_type.hpp"
|
||||
# include "asio/async_result.hpp"
|
||||
#endif // defined(ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
|
||||
|
||||
// Newer gcc, clang need special treatment to suppress unused typedef warnings.
|
||||
|
@ -22,7 +22,8 @@
|
||||
|
||||
namespace asio {
|
||||
|
||||
/// Default handler type traits provided for all completion token types.
|
||||
/// (Deprecated: Use two-parameter version of async_result.) Default handler
|
||||
/// type traits provided for all completion token types.
|
||||
/**
|
||||
* The handler_type traits class is used for determining the concrete handler
|
||||
* type to be used for an asynchronous operation. It allows the handler type to
|
||||
@ -46,7 +47,4 @@ struct handler_type
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#define ASIO_HANDLER_TYPE(h, sig) \
|
||||
typename handler_type<h, sig>::type
|
||||
|
||||
#endif // ASIO_HANDLER_TYPE_HPP
|
||||
|
@ -191,7 +191,7 @@ buffered_read_stream<Stream>::async_fill(
|
||||
storage_.size() - previous_size),
|
||||
detail::buffered_fill_handler<ASIO_HANDLER_TYPE(
|
||||
ReadHandler, void (asio::error_code, std::size_t))>(
|
||||
storage_, previous_size, init.handler));
|
||||
storage_, previous_size, init.completion_handler));
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -385,14 +385,14 @@ buffered_read_stream<Stream>::async_read_some(
|
||||
detail::buffered_read_some_handler<
|
||||
MutableBufferSequence, ASIO_HANDLER_TYPE(
|
||||
ReadHandler, void (asio::error_code, std::size_t))>(
|
||||
storage_, buffers, init.handler));
|
||||
storage_, buffers, init.completion_handler));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->async_fill(detail::buffered_read_some_handler<
|
||||
MutableBufferSequence, ASIO_HANDLER_TYPE(
|
||||
ReadHandler, void (asio::error_code, std::size_t))>(
|
||||
storage_, buffers, init.handler));
|
||||
storage_, buffers, init.completion_handler));
|
||||
}
|
||||
|
||||
return init.result.get();
|
||||
|
@ -172,7 +172,7 @@ buffered_write_stream<Stream>::async_flush(
|
||||
async_write(next_layer_, buffer(storage_.data(), storage_.size()),
|
||||
detail::buffered_flush_handler<ASIO_HANDLER_TYPE(
|
||||
WriteHandler, void (asio::error_code, std::size_t))>(
|
||||
storage_, init.handler));
|
||||
storage_, init.completion_handler));
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -372,14 +372,14 @@ buffered_write_stream<Stream>::async_write_some(
|
||||
detail::buffered_write_some_handler<
|
||||
ConstBufferSequence, ASIO_HANDLER_TYPE(
|
||||
WriteHandler, void (asio::error_code, std::size_t))>(
|
||||
storage_, buffers, init.handler));
|
||||
storage_, buffers, init.completion_handler));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->async_flush(detail::buffered_write_some_handler<
|
||||
ConstBufferSequence, ASIO_HANDLER_TYPE(
|
||||
WriteHandler, void (asio::error_code, std::size_t))>(
|
||||
storage_, buffers, init.handler));
|
||||
storage_, buffers, init.completion_handler));
|
||||
}
|
||||
|
||||
return init.result.get();
|
||||
|
@ -659,8 +659,8 @@ async_connect(basic_socket<Protocol ASIO_SVC_TARG>& s,
|
||||
detail::default_connect_condition,
|
||||
ASIO_HANDLER_TYPE(RangeConnectHandler,
|
||||
void (asio::error_code, typename Protocol::endpoint))>(s,
|
||||
endpoints, detail::default_connect_condition(), init.handler)(
|
||||
asio::error_code(), 1);
|
||||
endpoints, detail::default_connect_condition(),
|
||||
init.completion_handler)(asio::error_code(), 1);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -685,8 +685,8 @@ async_connect(basic_socket<Protocol ASIO_SVC_TARG>& s,
|
||||
detail::iterator_connect_op<Protocol ASIO_SVC_TARG, Iterator,
|
||||
detail::default_connect_condition, ASIO_HANDLER_TYPE(
|
||||
IteratorConnectHandler, void (asio::error_code, Iterator))>(s,
|
||||
begin, Iterator(), detail::default_connect_condition(), init.handler)(
|
||||
asio::error_code(), 1);
|
||||
begin, Iterator(), detail::default_connect_condition(),
|
||||
init.completion_handler)(asio::error_code(), 1);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -711,8 +711,8 @@ async_connect(basic_socket<Protocol ASIO_SVC_TARG>& s,
|
||||
detail::iterator_connect_op<Protocol ASIO_SVC_TARG, Iterator,
|
||||
detail::default_connect_condition, ASIO_HANDLER_TYPE(
|
||||
IteratorConnectHandler, void (asio::error_code, Iterator))>(s,
|
||||
begin, end, detail::default_connect_condition(), init.handler)(
|
||||
asio::error_code(), 1);
|
||||
begin, end, detail::default_connect_condition(),
|
||||
init.completion_handler)(asio::error_code(), 1);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -739,7 +739,7 @@ async_connect(basic_socket<Protocol ASIO_SVC_TARG>& s,
|
||||
detail::range_connect_op<Protocol ASIO_SVC_TARG, EndpointSequence,
|
||||
ConnectCondition, ASIO_HANDLER_TYPE(RangeConnectHandler,
|
||||
void (asio::error_code, typename Protocol::endpoint))>(s,
|
||||
endpoints, connect_condition, init.handler)(
|
||||
endpoints, connect_condition, init.completion_handler)(
|
||||
asio::error_code(), 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -766,7 +766,7 @@ async_connect(basic_socket<Protocol ASIO_SVC_TARG>& s,
|
||||
detail::iterator_connect_op<Protocol ASIO_SVC_TARG, Iterator,
|
||||
ConnectCondition, ASIO_HANDLER_TYPE(
|
||||
IteratorConnectHandler, void (asio::error_code, Iterator))>(s,
|
||||
begin, Iterator(), connect_condition, init.handler)(
|
||||
begin, Iterator(), connect_condition, init.completion_handler)(
|
||||
asio::error_code(), 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -792,7 +792,7 @@ async_connect(basic_socket<Protocol ASIO_SVC_TARG>& s,
|
||||
detail::iterator_connect_op<Protocol ASIO_SVC_TARG, Iterator,
|
||||
ConnectCondition, ASIO_HANDLER_TYPE(
|
||||
IteratorConnectHandler, void (asio::error_code, Iterator))>(s,
|
||||
begin, end, connect_condition, init.handler)(
|
||||
begin, end, connect_condition, init.completion_handler)(
|
||||
asio::error_code(), 1);
|
||||
|
||||
return init.result.get();
|
||||
|
@ -28,18 +28,19 @@ template <typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
ASIO_MOVE_ARG(CompletionToken) token)
|
||||
{
|
||||
typedef typename handler_type<CompletionToken, void()>::type handler;
|
||||
async_completion<CompletionToken, void()> completion(token);
|
||||
typedef ASIO_HANDLER_TYPE(CompletionToken, void()) handler;
|
||||
|
||||
async_completion<CompletionToken, void()> init(token);
|
||||
|
||||
typename associated_executor<handler>::type ex(
|
||||
(get_associated_executor)(completion.handler));
|
||||
(get_associated_executor)(init.completion_handler));
|
||||
|
||||
typename associated_allocator<handler>::type alloc(
|
||||
(get_associated_allocator)(completion.handler));
|
||||
(get_associated_allocator)(init.completion_handler));
|
||||
|
||||
ex.defer(ASIO_MOVE_CAST(handler)(completion.handler), alloc);
|
||||
ex.defer(ASIO_MOVE_CAST(handler)(init.completion_handler), alloc);
|
||||
|
||||
return completion.result.get();
|
||||
return init.result.get();
|
||||
}
|
||||
|
||||
template <typename Executor, typename CompletionToken>
|
||||
@ -47,17 +48,18 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
const Executor& ex, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
typename enable_if<is_executor<Executor>::value>::type*)
|
||||
{
|
||||
typedef typename handler_type<CompletionToken, void()>::type handler;
|
||||
async_completion<CompletionToken, void()> completion(token);
|
||||
typedef ASIO_HANDLER_TYPE(CompletionToken, void()) handler;
|
||||
|
||||
async_completion<CompletionToken, void()> init(token);
|
||||
|
||||
Executor ex1(ex);
|
||||
|
||||
typename associated_allocator<handler>::type alloc(
|
||||
(get_associated_allocator)(completion.handler));
|
||||
(get_associated_allocator)(init.completion_handler));
|
||||
|
||||
ex1.defer(detail::work_dispatcher<handler>(completion.handler), alloc);
|
||||
ex1.defer(detail::work_dispatcher<handler>(init.completion_handler), alloc);
|
||||
|
||||
return completion.result.get();
|
||||
return init.result.get();
|
||||
}
|
||||
|
||||
template <typename ExecutionContext, typename CompletionToken>
|
||||
|
@ -28,18 +28,19 @@ template <typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
ASIO_MOVE_ARG(CompletionToken) token)
|
||||
{
|
||||
typedef typename handler_type<CompletionToken, void()>::type handler;
|
||||
async_completion<CompletionToken, void()> completion(token);
|
||||
typedef ASIO_HANDLER_TYPE(CompletionToken, void()) handler;
|
||||
|
||||
async_completion<CompletionToken, void()> init(token);
|
||||
|
||||
typename associated_executor<handler>::type ex(
|
||||
(get_associated_executor)(completion.handler));
|
||||
(get_associated_executor)(init.completion_handler));
|
||||
|
||||
typename associated_allocator<handler>::type alloc(
|
||||
(get_associated_allocator)(completion.handler));
|
||||
(get_associated_allocator)(init.completion_handler));
|
||||
|
||||
ex.dispatch(ASIO_MOVE_CAST(handler)(completion.handler), alloc);
|
||||
ex.dispatch(ASIO_MOVE_CAST(handler)(init.completion_handler), alloc);
|
||||
|
||||
return completion.result.get();
|
||||
return init.result.get();
|
||||
}
|
||||
|
||||
template <typename Executor, typename CompletionToken>
|
||||
@ -47,17 +48,19 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
const Executor& ex, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
typename enable_if<is_executor<Executor>::value>::type*)
|
||||
{
|
||||
typedef typename handler_type<CompletionToken, void()>::type handler;
|
||||
async_completion<CompletionToken, void()> completion(token);
|
||||
typedef ASIO_HANDLER_TYPE(CompletionToken, void()) handler;
|
||||
|
||||
async_completion<CompletionToken, void()> init(token);
|
||||
|
||||
Executor ex1(ex);
|
||||
|
||||
typename associated_allocator<handler>::type alloc(
|
||||
(get_associated_allocator)(completion.handler));
|
||||
(get_associated_allocator)(init.completion_handler));
|
||||
|
||||
ex1.dispatch(detail::work_dispatcher<handler>(completion.handler), alloc);
|
||||
ex1.dispatch(detail::work_dispatcher<handler>(
|
||||
init.completion_handler), alloc);
|
||||
|
||||
return completion.result.get();
|
||||
return init.result.get();
|
||||
}
|
||||
|
||||
template <typename ExecutionContext, typename CompletionToken>
|
||||
|
@ -84,16 +84,17 @@ io_context::dispatch(ASIO_MOVE_ARG(CompletionHandler) handler)
|
||||
if (impl_.can_dispatch())
|
||||
{
|
||||
detail::fenced_block b(detail::fenced_block::full);
|
||||
asio_handler_invoke_helpers::invoke(init.handler, init.handler);
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
init.completion_handler, init.completion_handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Allocate and construct an operation to wrap the handler.
|
||||
typedef detail::completion_handler<
|
||||
typename handler_type<CompletionHandler, void ()>::type> op;
|
||||
typename op::ptr p = { detail::addressof(init.handler),
|
||||
op::ptr::allocate(init.handler), 0 };
|
||||
p.p = new (p.v) op(init.handler);
|
||||
typename op::ptr p = { detail::addressof(init.completion_handler),
|
||||
op::ptr::allocate(init.completion_handler), 0 };
|
||||
p.p = new (p.v) op(init.completion_handler);
|
||||
|
||||
ASIO_HANDLER_CREATION((*this, *p.p,
|
||||
"io_context", this, 0, "dispatch"));
|
||||
@ -116,14 +117,14 @@ io_context::post(ASIO_MOVE_ARG(CompletionHandler) handler)
|
||||
async_completion<CompletionHandler, void ()> init(handler);
|
||||
|
||||
bool is_continuation =
|
||||
asio_handler_cont_helpers::is_continuation(init.handler);
|
||||
asio_handler_cont_helpers::is_continuation(init.completion_handler);
|
||||
|
||||
// Allocate and construct an operation to wrap the handler.
|
||||
typedef detail::completion_handler<
|
||||
typename handler_type<CompletionHandler, void ()>::type> op;
|
||||
typename op::ptr p = { detail::addressof(init.handler),
|
||||
op::ptr::allocate(init.handler), 0 };
|
||||
p.p = new (p.v) op(init.handler);
|
||||
typename op::ptr p = { detail::addressof(init.completion_handler),
|
||||
op::ptr::allocate(init.completion_handler), 0 };
|
||||
p.p = new (p.v) op(init.completion_handler);
|
||||
|
||||
ASIO_HANDLER_CREATION((*this, *p.p,
|
||||
"io_context", this, 0, "post"));
|
||||
|
@ -28,18 +28,19 @@ template <typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
|
||||
ASIO_MOVE_ARG(CompletionToken) token)
|
||||
{
|
||||
typedef typename handler_type<CompletionToken, void()>::type handler;
|
||||
async_completion<CompletionToken, void()> completion(token);
|
||||
typedef ASIO_HANDLER_TYPE(CompletionToken, void()) handler;
|
||||
|
||||
async_completion<CompletionToken, void()> init(token);
|
||||
|
||||
typename associated_executor<handler>::type ex(
|
||||
(get_associated_executor)(completion.handler));
|
||||
(get_associated_executor)(init.completion_handler));
|
||||
|
||||
typename associated_allocator<handler>::type alloc(
|
||||
(get_associated_allocator)(completion.handler));
|
||||
(get_associated_allocator)(init.completion_handler));
|
||||
|
||||
ex.post(ASIO_MOVE_CAST(handler)(completion.handler), alloc);
|
||||
ex.post(ASIO_MOVE_CAST(handler)(init.completion_handler), alloc);
|
||||
|
||||
return completion.result.get();
|
||||
return init.result.get();
|
||||
}
|
||||
|
||||
template <typename Executor, typename CompletionToken>
|
||||
@ -47,17 +48,18 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
|
||||
const Executor& ex, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
typename enable_if<is_executor<Executor>::value>::type*)
|
||||
{
|
||||
typedef typename handler_type<CompletionToken, void()>::type handler;
|
||||
async_completion<CompletionToken, void()> completion(token);
|
||||
typedef ASIO_HANDLER_TYPE(CompletionToken, void()) handler;
|
||||
|
||||
async_completion<CompletionToken, void()> init(token);
|
||||
|
||||
Executor ex1(ex);
|
||||
|
||||
typename associated_allocator<handler>::type alloc(
|
||||
(get_associated_allocator)(completion.handler));
|
||||
(get_associated_allocator)(init.completion_handler));
|
||||
|
||||
ex1.post(detail::work_dispatcher<handler>(completion.handler), alloc);
|
||||
ex1.post(detail::work_dispatcher<handler>(init.completion_handler), alloc);
|
||||
|
||||
return completion.result.get();
|
||||
return init.result.get();
|
||||
}
|
||||
|
||||
template <typename ExecutionContext, typename CompletionToken>
|
||||
|
@ -645,7 +645,7 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
detail::read_op<AsyncReadStream, MutableBufferSequence,
|
||||
CompletionCondition, ASIO_HANDLER_TYPE(
|
||||
ReadHandler, void (asio::error_code, std::size_t))>(
|
||||
s, buffers, completion_condition, init.handler)(
|
||||
s, buffers, completion_condition, init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -671,7 +671,7 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
detail::read_op<AsyncReadStream, MutableBufferSequence,
|
||||
detail::transfer_all_t, ASIO_HANDLER_TYPE(
|
||||
ReadHandler, void (asio::error_code, std::size_t))>(
|
||||
s, buffers, transfer_all(), init.handler)(
|
||||
s, buffers, transfer_all(), init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -897,7 +897,7 @@ async_read(AsyncReadStream& s,
|
||||
CompletionCondition, ASIO_HANDLER_TYPE(
|
||||
ReadHandler, void (asio::error_code, std::size_t))>(
|
||||
s, ASIO_MOVE_CAST(DynamicBufferSequence)(buffers),
|
||||
completion_condition, init.handler)(
|
||||
completion_condition, init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
|
@ -624,7 +624,7 @@ async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence,
|
||||
CompletionCondition, ASIO_HANDLER_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))>(
|
||||
d, offset, buffers, completion_condition, init.handler)(
|
||||
d, offset, buffers, completion_condition, init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -648,7 +648,7 @@ async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence,
|
||||
detail::transfer_all_t, ASIO_HANDLER_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))>(
|
||||
d, offset, buffers, transfer_all(), init.handler)(
|
||||
d, offset, buffers, transfer_all(), init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -849,7 +849,7 @@ async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
|
||||
CompletionCondition, ASIO_HANDLER_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))>(
|
||||
d, offset, b, completion_condition, init.handler)(
|
||||
d, offset, b, completion_condition, init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -873,7 +873,7 @@ async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
|
||||
detail::transfer_all_t, ASIO_HANDLER_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))>(
|
||||
d, offset, b, transfer_all(), init.handler)(
|
||||
d, offset, b, transfer_all(), init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
|
@ -656,7 +656,7 @@ async_read_until(AsyncReadStream& s,
|
||||
ASIO_HANDLER_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))>(
|
||||
s, ASIO_MOVE_CAST(DynamicBufferSequence)(buffers),
|
||||
delim, init.handler)(asio::error_code(), 0, 1);
|
||||
delim, init.completion_handler)(asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -909,7 +909,7 @@ async_read_until(AsyncReadStream& s,
|
||||
ASIO_HANDLER_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))>(
|
||||
s, ASIO_MOVE_CAST(DynamicBufferSequence)(buffers),
|
||||
delim, init.handler)(asio::error_code(), 0, 1);
|
||||
delim, init.completion_handler)(asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -1168,7 +1168,7 @@ async_read_until(AsyncReadStream& s,
|
||||
boost::regex, ASIO_HANDLER_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))>(
|
||||
s, ASIO_MOVE_CAST(DynamicBufferSequence)(buffers),
|
||||
expr, init.handler)(asio::error_code(), 0, 1);
|
||||
expr, init.completion_handler)(asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -1425,7 +1425,8 @@ async_read_until(AsyncReadStream& s,
|
||||
MatchCondition, ASIO_HANDLER_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))>(
|
||||
s, ASIO_MOVE_CAST(DynamicBufferSequence)(buffers),
|
||||
match_condition, init.handler)(asio::error_code(), 0, 1);
|
||||
match_condition, init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "asio/detail/handler_invoke_helpers.hpp"
|
||||
#include "asio/detail/memory.hpp"
|
||||
#include "asio/detail/noncopyable.hpp"
|
||||
#include "asio/handler_type.hpp"
|
||||
#include "asio/system_error.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <future>
|
||||
#include "asio/async_result.hpp"
|
||||
#include "asio/error_code.hpp"
|
||||
#include "asio/handler_type.hpp"
|
||||
#include "asio/system_error.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
@ -705,7 +705,7 @@ async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
detail::write_op<AsyncWriteStream, ConstBufferSequence,
|
||||
CompletionCondition, ASIO_HANDLER_TYPE(
|
||||
WriteHandler, void (asio::error_code, std::size_t))>(
|
||||
s, buffers, completion_condition, init.handler)(
|
||||
s, buffers, completion_condition, init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -731,7 +731,7 @@ async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
detail::write_op<AsyncWriteStream, ConstBufferSequence,
|
||||
detail::transfer_all_t, ASIO_HANDLER_TYPE(
|
||||
WriteHandler, void (asio::error_code, std::size_t))>(
|
||||
s, buffers, transfer_all(), init.handler)(
|
||||
s, buffers, transfer_all(), init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -930,7 +930,7 @@ async_write(AsyncWriteStream& s,
|
||||
CompletionCondition, ASIO_HANDLER_TYPE(
|
||||
WriteHandler, void (asio::error_code, std::size_t))>(
|
||||
s, ASIO_MOVE_CAST(DynamicBufferSequence)(buffers),
|
||||
completion_condition, init.handler)(
|
||||
completion_condition, init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
|
@ -686,7 +686,7 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence,
|
||||
CompletionCondition, ASIO_HANDLER_TYPE(
|
||||
WriteHandler, void (asio::error_code, std::size_t))>(
|
||||
d, offset, buffers, completion_condition, init.handler)(
|
||||
d, offset, buffers, completion_condition, init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -710,7 +710,7 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence,
|
||||
detail::transfer_all_t, ASIO_HANDLER_TYPE(
|
||||
WriteHandler, void (asio::error_code, std::size_t))>(
|
||||
d, offset, buffers, transfer_all(), init.handler)(
|
||||
d, offset, buffers, transfer_all(), init.completion_handler)(
|
||||
asio::error_code(), 0, 1);
|
||||
|
||||
return init.result.get();
|
||||
@ -860,7 +860,7 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
async_write_at(d, offset, b.data(), completion_condition,
|
||||
detail::write_at_streambuf_op<Allocator, ASIO_HANDLER_TYPE(
|
||||
WriteHandler, void (asio::error_code, std::size_t))>(
|
||||
b, init.handler));
|
||||
b, init.completion_handler));
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -883,7 +883,7 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
async_write_at(d, offset, b.data(), transfer_all(),
|
||||
detail::write_at_streambuf_op<Allocator, ASIO_HANDLER_TYPE(
|
||||
WriteHandler, void (asio::error_code, std::size_t))>(
|
||||
b, init.handler));
|
||||
b, init.completion_handler));
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ public:
|
||||
|
||||
async_completion<CompletionHandler, void ()> init(handler);
|
||||
|
||||
service_.dispatch(impl_, init.handler);
|
||||
service_.dispatch(impl_, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -272,7 +272,7 @@ public:
|
||||
|
||||
async_completion<CompletionHandler, void ()> init(handler);
|
||||
|
||||
service_.post(impl_, init.handler);
|
||||
service_.post(impl_, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ public:
|
||||
void (asio::error_code, results_type)> init(handler);
|
||||
|
||||
this->get_service().async_resolve(
|
||||
this->get_implementation(), q, init.handler);
|
||||
this->get_implementation(), q, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -760,7 +760,7 @@ public:
|
||||
void (asio::error_code, results_type)> init(handler);
|
||||
|
||||
this->get_service().async_resolve(
|
||||
this->get_implementation(), q, init.handler);
|
||||
this->get_implementation(), q, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -893,7 +893,7 @@ public:
|
||||
void (asio::error_code, results_type)> init(handler);
|
||||
|
||||
this->get_service().async_resolve(
|
||||
this->get_implementation(), q, init.handler);
|
||||
this->get_implementation(), q, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
@ -984,7 +984,7 @@ public:
|
||||
void (asio::error_code, results_type)> init(handler);
|
||||
|
||||
this->get_service().async_resolve(
|
||||
this->get_implementation(), e, init.handler);
|
||||
this->get_implementation(), e, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
asio::async_completion<ResolveHandler,
|
||||
void (asio::error_code, results_type)> init(handler);
|
||||
|
||||
service_impl_.async_resolve(impl, query, init.handler);
|
||||
service_impl_.async_resolve(impl, query, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -168,7 +168,7 @@ public:
|
||||
asio::async_completion<ResolveHandler,
|
||||
void (asio::error_code, results_type)> init(handler);
|
||||
|
||||
service_impl_.async_resolve(impl, endpoint, init.handler);
|
||||
service_impl_.async_resolve(impl, endpoint, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "asio/async_result.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/detail/variadic_templates.hpp"
|
||||
#include "asio/handler_type.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
|
@ -607,7 +607,7 @@ public:
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
this->get_service().async_wait(
|
||||
this->get_implementation(), w, init.handler);
|
||||
this->get_implementation(), w, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_write_some(
|
||||
this->get_implementation(), buffers, init.handler);
|
||||
this->get_implementation(), buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -344,7 +344,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_read_some(
|
||||
this->get_implementation(), buffers, init.handler);
|
||||
this->get_implementation(), buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_wait(impl, w, init.handler);
|
||||
service_impl_.async_wait(impl, w, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -219,7 +219,7 @@ public:
|
||||
asio::async_completion<WriteHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_write_some(impl, buffers, init.handler);
|
||||
service_impl_.async_write_some(impl, buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -243,7 +243,7 @@ public:
|
||||
asio::async_completion<ReadHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_read_some(impl, buffers, init.handler);
|
||||
service_impl_.async_read_some(impl, buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public:
|
||||
async_completion<ConnectHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_connect(impl, peer_endpoint, init.handler);
|
||||
service_impl_.async_connect(impl, peer_endpoint, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -312,7 +312,7 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_wait(impl, w, init.handler);
|
||||
service_impl_.async_wait(impl, w, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -337,7 +337,7 @@ public:
|
||||
async_completion<WriteHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_send(impl, buffers, flags, init.handler);
|
||||
service_impl_.async_send(impl, buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -364,7 +364,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_send_to(impl, buffers,
|
||||
destination, flags, init.handler);
|
||||
destination, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -390,7 +390,7 @@ public:
|
||||
async_completion<ReadHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_receive(impl, buffers, flags, init.handler);
|
||||
service_impl_.async_receive(impl, buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -418,7 +418,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_receive_from(impl, buffers,
|
||||
sender_endpoint, flags, init.handler);
|
||||
sender_endpoint, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public:
|
||||
async_completion<ConnectHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_connect(impl, peer_endpoint, init.handler);
|
||||
service_impl_.async_connect(impl, peer_endpoint, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -314,7 +314,7 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_wait(impl, w, init.handler);
|
||||
service_impl_.async_wait(impl, w, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -340,7 +340,7 @@ public:
|
||||
async_completion<WriteHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_send(impl, buffers, flags, init.handler);
|
||||
service_impl_.async_send(impl, buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -368,7 +368,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_receive_with_flags(impl,
|
||||
buffers, in_flags, out_flags, init.handler);
|
||||
buffers, in_flags, out_flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_write_some(
|
||||
this->get_implementation(), buffers, init.handler);
|
||||
this->get_implementation(), buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -743,7 +743,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_read_some(
|
||||
this->get_implementation(), buffers, init.handler);
|
||||
this->get_implementation(), buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public:
|
||||
async_completion<WriteHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_write_some(impl, buffers, init.handler);
|
||||
service_impl_.async_write_some(impl, buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -214,7 +214,7 @@ public:
|
||||
async_completion<ReadHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_read_some(impl, buffers, init.handler);
|
||||
service_impl_.async_read_some(impl, buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -432,7 +432,8 @@ public:
|
||||
async_completion<SignalHandler,
|
||||
void (asio::error_code, int)> init(handler);
|
||||
|
||||
this->get_service().async_wait(this->get_implementation(), init.handler);
|
||||
this->get_service().async_wait(this->get_implementation(),
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
async_completion<SignalHandler,
|
||||
void (asio::error_code, int)> init(handler);
|
||||
|
||||
service_impl_.async_wait(impl, init.handler);
|
||||
service_impl_.async_wait(impl, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_wait(impl, w, init.handler);
|
||||
service_impl_.async_wait(impl, w, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -302,7 +302,8 @@ public:
|
||||
async_completion<AcceptHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_accept(impl, peer, peer_endpoint, init.handler);
|
||||
service_impl_.async_accept(impl,
|
||||
peer, peer_endpoint, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -321,7 +322,7 @@ public:
|
||||
typename Protocol::socket)> init(handler);
|
||||
|
||||
service_impl_.async_accept(impl,
|
||||
peer_io_context, peer_endpoint, init.handler);
|
||||
peer_io_context, peer_endpoint, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public:
|
||||
async_completion<ConnectHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_connect(impl, peer_endpoint, init.handler);
|
||||
service_impl_.async_connect(impl, peer_endpoint, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -312,7 +312,7 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_wait(impl, w, init.handler);
|
||||
service_impl_.async_wait(impl, w, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -338,7 +338,7 @@ public:
|
||||
async_completion<WriteHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_send(impl, buffers, flags, init.handler);
|
||||
service_impl_.async_send(impl, buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -364,7 +364,7 @@ public:
|
||||
async_completion<ReadHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_receive(impl, buffers, flags, init.handler);
|
||||
service_impl_.async_receive(impl, buffers, flags, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public:
|
||||
async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_wait(impl, init.handler);
|
||||
service_impl_.async_wait(impl, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -357,7 +357,8 @@ public:
|
||||
asio::async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
this->get_service().async_wait(this->get_implementation(), init.handler);
|
||||
this->get_service().async_wait(this->get_implementation(),
|
||||
init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public:
|
||||
asio::async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
service_impl_.async_wait(impl, init.handler);
|
||||
service_impl_.async_wait(impl, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_write_some_at(this->get_implementation(),
|
||||
offset, buffers, init.handler);
|
||||
offset, buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -360,7 +360,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_read_some_at(this->get_implementation(),
|
||||
offset, buffers, init.handler);
|
||||
offset, buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -156,7 +156,8 @@ public:
|
||||
asio::async_completion<WriteHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_write_some_at(impl, offset, buffers, init.handler);
|
||||
service_impl_.async_write_some_at(impl,
|
||||
offset, buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -180,7 +181,8 @@ public:
|
||||
asio::async_completion<ReadHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_read_some_at(impl, offset, buffers, init.handler);
|
||||
service_impl_.async_read_some_at(impl,
|
||||
offset, buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_write_some(
|
||||
this->get_implementation(), buffers, init.handler);
|
||||
this->get_implementation(), buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -344,7 +344,7 @@ public:
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->get_service().async_read_some(
|
||||
this->get_implementation(), buffers, init.handler);
|
||||
this->get_implementation(), buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public:
|
||||
asio::async_completion<WriteHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_write_some(impl, buffers, init.handler);
|
||||
service_impl_.async_write_some(impl, buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
@ -178,7 +178,7 @@ public:
|
||||
asio::async_completion<ReadHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
service_impl_.async_read_some(impl, buffers, init.handler);
|
||||
service_impl_.async_read_some(impl, buffers, init.completion_handler);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -366,6 +366,7 @@ EXTRA_DIST = \
|
||||
latency/allocator.hpp \
|
||||
performance/handler_allocator.hpp \
|
||||
unit/archetypes/async_result.hpp \
|
||||
unit/archetypes/deprecated_async_result.hpp \
|
||||
unit/archetypes/gettable_socket_option.hpp \
|
||||
unit/archetypes/io_control_command.hpp \
|
||||
unit/archetypes/settable_socket_option.hpp
|
||||
|
@ -12,7 +12,6 @@
|
||||
#define ARCHETYPES_ASYNC_RESULT_HPP
|
||||
|
||||
#include <asio/async_result.hpp>
|
||||
#include <asio/handler_type.hpp>
|
||||
|
||||
namespace archetypes {
|
||||
|
||||
@ -48,28 +47,30 @@ private:
|
||||
namespace asio {
|
||||
|
||||
template <typename Signature>
|
||||
struct handler_type<archetypes::lazy_handler, Signature>
|
||||
{
|
||||
typedef archetypes::concrete_handler type;
|
||||
};
|
||||
|
||||
template <>
|
||||
class async_result<archetypes::concrete_handler>
|
||||
class async_result<archetypes::lazy_handler, Signature>
|
||||
{
|
||||
public:
|
||||
// The concrete completion handler type.
|
||||
typedef archetypes::concrete_handler completion_handler_type;
|
||||
|
||||
// The return type of the initiating function.
|
||||
typedef int type;
|
||||
typedef int return_type;
|
||||
|
||||
// Construct an async_result from a given handler.
|
||||
explicit async_result(archetypes::concrete_handler&)
|
||||
explicit async_result(completion_handler_type&)
|
||||
{
|
||||
}
|
||||
|
||||
// Obtain the value to be returned from the initiating function.
|
||||
type get()
|
||||
return_type get()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
private:
|
||||
// Disallow copying and assignment.
|
||||
async_result(const async_result&) ASIO_DELETED;
|
||||
async_result& operator=(const async_result&) ASIO_DELETED;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
82
asio/src/tests/unit/archetypes/deprecated_async_result.hpp
Normal file
82
asio/src/tests/unit/archetypes/deprecated_async_result.hpp
Normal file
@ -0,0 +1,82 @@
|
||||
//
|
||||
// async_result.hpp
|
||||
// ~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2015 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)
|
||||
//
|
||||
|
||||
#ifndef ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP
|
||||
#define ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP
|
||||
|
||||
#include <asio/async_result.hpp>
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
#include <asio/handler_type.hpp>
|
||||
|
||||
namespace archetypes {
|
||||
|
||||
struct deprecated_lazy_handler
|
||||
{
|
||||
};
|
||||
|
||||
struct deprecated_concrete_handler
|
||||
{
|
||||
deprecated_concrete_handler(deprecated_lazy_handler)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Arg1>
|
||||
void operator()(Arg1)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Arg1, typename Arg2>
|
||||
void operator()(Arg1, Arg2)
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
deprecated_concrete_handler(deprecated_concrete_handler&&) {}
|
||||
private:
|
||||
deprecated_concrete_handler(const deprecated_concrete_handler&);
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
} // namespace archetypes
|
||||
|
||||
namespace asio {
|
||||
|
||||
template <typename Signature>
|
||||
struct handler_type<archetypes::deprecated_lazy_handler, Signature>
|
||||
{
|
||||
typedef archetypes::deprecated_concrete_handler type;
|
||||
};
|
||||
|
||||
template <>
|
||||
class async_result<archetypes::deprecated_concrete_handler>
|
||||
{
|
||||
public:
|
||||
// The return type of the initiating function.
|
||||
typedef double type;
|
||||
|
||||
// Construct an async_result from a given handler.
|
||||
explicit async_result(archetypes::deprecated_concrete_handler&)
|
||||
{
|
||||
}
|
||||
|
||||
// Obtain the value to be returned from the initiating function.
|
||||
type get()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
#endif // ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP
|
@ -20,8 +20,9 @@
|
||||
#include "asio/io_context.hpp"
|
||||
#include "asio/placeholders.hpp"
|
||||
#include "../unit_test.hpp"
|
||||
#include "../archetypes/gettable_socket_option.hpp"
|
||||
#include "../archetypes/async_result.hpp"
|
||||
#include "../archetypes/deprecated_async_result.hpp"
|
||||
#include "../archetypes/gettable_socket_option.hpp"
|
||||
#include "../archetypes/io_control_command.hpp"
|
||||
#include "../archetypes/settable_socket_option.hpp"
|
||||
|
||||
@ -86,6 +87,9 @@ void test()
|
||||
archetypes::gettable_socket_option<double> gettable_socket_option3;
|
||||
archetypes::io_control_command io_control_command;
|
||||
archetypes::lazy_handler lazy;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
archetypes::deprecated_lazy_handler dlazy;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
asio::error_code ec;
|
||||
|
||||
// basic_datagram_socket constructors.
|
||||
@ -182,6 +186,14 @@ void test()
|
||||
(void)i1;
|
||||
int i2 = socket1.async_connect(ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
|
||||
(void)i2;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d1 = socket1.async_connect(
|
||||
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
|
||||
(void)d1;
|
||||
double d2 = socket1.async_connect(
|
||||
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
|
||||
(void)d2;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
socket1.set_option(settable_socket_option1);
|
||||
socket1.set_option(settable_socket_option1, ec);
|
||||
@ -249,6 +261,21 @@ void test()
|
||||
(void)i7;
|
||||
int i8 = socket1.async_send(null_buffers(), in_flags, lazy);
|
||||
(void)i8;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d3 = socket1.async_send(buffer(mutable_char_buffer), dlazy);
|
||||
(void)d3;
|
||||
double d4 = socket1.async_send(buffer(const_char_buffer), dlazy);
|
||||
(void)d4;
|
||||
double d5 = socket1.async_send(null_buffers(), dlazy);
|
||||
(void)d5;
|
||||
double d6 = socket1.async_send(
|
||||
buffer(mutable_char_buffer), in_flags, dlazy);
|
||||
(void)d6;
|
||||
double d7 = socket1.async_send(buffer(const_char_buffer), in_flags, dlazy);
|
||||
(void)d7;
|
||||
double d8 = socket1.async_send(null_buffers(), in_flags, dlazy);
|
||||
(void)d8;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
socket1.send_to(buffer(mutable_char_buffer),
|
||||
ip::icmp::endpoint(ip::icmp::v4(), 0));
|
||||
@ -347,6 +374,44 @@ void test()
|
||||
int i20 = socket1.async_send_to(null_buffers(),
|
||||
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
|
||||
(void)i20;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d9 = socket1.async_send_to(buffer(mutable_char_buffer),
|
||||
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
|
||||
(void)d9;
|
||||
double d10 = socket1.async_send_to(buffer(mutable_char_buffer),
|
||||
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
|
||||
(void)d10;
|
||||
double d11 = socket1.async_send_to(buffer(const_char_buffer),
|
||||
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
|
||||
(void)d11;
|
||||
double d12 = socket1.async_send_to(buffer(const_char_buffer),
|
||||
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
|
||||
(void)d12;
|
||||
double d13 = socket1.async_send_to(null_buffers(),
|
||||
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
|
||||
(void)d13;
|
||||
double d14 = socket1.async_send_to(null_buffers(),
|
||||
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
|
||||
(void)d14;
|
||||
double d15 = socket1.async_send_to(buffer(mutable_char_buffer),
|
||||
ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
|
||||
(void)d15;
|
||||
double d16 = socket1.async_send_to(buffer(mutable_char_buffer),
|
||||
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
|
||||
(void)d16;
|
||||
double d17 = socket1.async_send_to(buffer(const_char_buffer),
|
||||
ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
|
||||
(void)d17;
|
||||
double d18 = socket1.async_send_to(buffer(const_char_buffer),
|
||||
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
|
||||
(void)d18;
|
||||
double d19 = socket1.async_send_to(null_buffers(),
|
||||
ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
|
||||
(void)d19;
|
||||
double d20 = socket1.async_send_to(null_buffers(),
|
||||
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
|
||||
(void)d20;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
socket1.receive(buffer(mutable_char_buffer));
|
||||
socket1.receive(null_buffers());
|
||||
@ -369,6 +434,17 @@ void test()
|
||||
(void)i23;
|
||||
int i24 = socket1.async_receive(null_buffers(), in_flags, lazy);
|
||||
(void)i24;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d21 = socket1.async_receive(buffer(mutable_char_buffer), dlazy);
|
||||
(void)d21;
|
||||
double d22 = socket1.async_receive(null_buffers(), dlazy);
|
||||
(void)d22;
|
||||
double d23 = socket1.async_receive(buffer(mutable_char_buffer),
|
||||
in_flags, dlazy);
|
||||
(void)d23;
|
||||
double d24 = socket1.async_receive(null_buffers(), in_flags, dlazy);
|
||||
(void)d24;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ip::icmp::endpoint endpoint;
|
||||
socket1.receive_from(buffer(mutable_char_buffer), endpoint);
|
||||
@ -398,6 +474,20 @@ void test()
|
||||
int i28 = socket1.async_receive_from(null_buffers(),
|
||||
endpoint, in_flags, lazy);
|
||||
(void)i28;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d25 = socket1.async_receive_from(buffer(mutable_char_buffer),
|
||||
endpoint, dlazy);
|
||||
(void)d25;
|
||||
double d26 = socket1.async_receive_from(null_buffers(),
|
||||
endpoint, dlazy);
|
||||
(void)d26;
|
||||
double d27 = socket1.async_receive_from(buffer(mutable_char_buffer),
|
||||
endpoint, in_flags, dlazy);
|
||||
(void)d27;
|
||||
double d28 = socket1.async_receive_from(null_buffers(),
|
||||
endpoint, in_flags, dlazy);
|
||||
(void)d28;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
@ -436,6 +526,9 @@ void test()
|
||||
{
|
||||
io_context ioc;
|
||||
archetypes::lazy_handler lazy;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
archetypes::deprecated_lazy_handler dlazy;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
asio::error_code ec;
|
||||
ip::icmp::resolver::query q(ip::icmp::v4(), "localhost", "0");
|
||||
ip::icmp::endpoint e(ip::address_v4::loopback(), 0);
|
||||
@ -530,6 +623,34 @@ void test()
|
||||
resolver.async_resolve(e, resolve_handler());
|
||||
int i6 = resolver.async_resolve(e, lazy);
|
||||
(void)i6;
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d1 = resolver.async_resolve(q, dlazy);
|
||||
(void)d1;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d2 = resolver.async_resolve("", "", dlazy);
|
||||
(void)d2;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d3 = resolver.async_resolve("", "",
|
||||
ip::icmp::resolver::flags(), dlazy);
|
||||
(void)d3;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d4 = resolver.async_resolve(ip::icmp::v4(), "", "", dlazy);
|
||||
(void)d4;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d5 = resolver.async_resolve(ip::icmp::v4(),
|
||||
"", "", ip::icmp::resolver::flags(), dlazy);
|
||||
(void)d5;
|
||||
|
||||
resolver.async_resolve(e, resolve_handler());
|
||||
double d6 = resolver.async_resolve(e, dlazy);
|
||||
(void)d6;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
|
@ -24,8 +24,9 @@
|
||||
#include "asio/read.hpp"
|
||||
#include "asio/write.hpp"
|
||||
#include "../unit_test.hpp"
|
||||
#include "../archetypes/gettable_socket_option.hpp"
|
||||
#include "../archetypes/async_result.hpp"
|
||||
#include "../archetypes/deprecated_async_result.hpp"
|
||||
#include "../archetypes/gettable_socket_option.hpp"
|
||||
#include "../archetypes/io_control_command.hpp"
|
||||
#include "../archetypes/settable_socket_option.hpp"
|
||||
|
||||
@ -234,6 +235,9 @@ void test()
|
||||
archetypes::gettable_socket_option<double> gettable_socket_option3;
|
||||
archetypes::io_control_command io_control_command;
|
||||
archetypes::lazy_handler lazy;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
archetypes::deprecated_lazy_handler dlazy;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
asio::error_code ec;
|
||||
|
||||
// basic_stream_socket constructors.
|
||||
@ -333,6 +337,14 @@ void test()
|
||||
(void)i1;
|
||||
int i2 = socket1.async_connect(ip::tcp::endpoint(ip::tcp::v6(), 0), lazy);
|
||||
(void)i2;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d1 = socket1.async_connect(
|
||||
ip::tcp::endpoint(ip::tcp::v4(), 0), dlazy);
|
||||
(void)d1;
|
||||
double d2 = socket1.async_connect(
|
||||
ip::tcp::endpoint(ip::tcp::v6(), 0), dlazy);
|
||||
(void)d2;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
socket1.set_option(settable_socket_option1);
|
||||
socket1.set_option(settable_socket_option1, ec);
|
||||
@ -376,6 +388,10 @@ void test()
|
||||
socket1.async_wait(socket_base::wait_read, wait_handler());
|
||||
int i3 = socket1.async_wait(socket_base::wait_write, lazy);
|
||||
(void)i3;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d3 = socket1.async_wait(socket_base::wait_write, dlazy);
|
||||
(void)d3;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
// basic_stream_socket functions.
|
||||
|
||||
@ -425,6 +441,29 @@ void test()
|
||||
(void)i12;
|
||||
int i13 = socket1.async_send(null_buffers(), in_flags, lazy);
|
||||
(void)i13;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d4 = socket1.async_send(buffer(mutable_char_buffer), dlazy);
|
||||
(void)d4;
|
||||
double d5 = socket1.async_send(buffer(const_char_buffer), dlazy);
|
||||
(void)d5;
|
||||
double d6 = socket1.async_send(mutable_buffers, dlazy);
|
||||
(void)d6;
|
||||
double d7 = socket1.async_send(const_buffers, dlazy);
|
||||
(void)d7;
|
||||
double d8 = socket1.async_send(null_buffers(), dlazy);
|
||||
(void)d8;
|
||||
double d9 = socket1.async_send(
|
||||
buffer(mutable_char_buffer), in_flags, dlazy);
|
||||
(void)d9;
|
||||
double d10 = socket1.async_send(buffer(const_char_buffer), in_flags, dlazy);
|
||||
(void)d10;
|
||||
double d11 = socket1.async_send(mutable_buffers, in_flags, dlazy);
|
||||
(void)d11;
|
||||
double d12 = socket1.async_send(const_buffers, in_flags, dlazy);
|
||||
(void)d12;
|
||||
double d13 = socket1.async_send(null_buffers(), in_flags, dlazy);
|
||||
(void)d13;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
socket1.receive(buffer(mutable_char_buffer));
|
||||
socket1.receive(mutable_buffers);
|
||||
@ -456,6 +495,21 @@ void test()
|
||||
(void)i18;
|
||||
int i19 = socket1.async_receive(null_buffers(), in_flags, lazy);
|
||||
(void)i19;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d14 = socket1.async_receive(buffer(mutable_char_buffer), dlazy);
|
||||
(void)d14;
|
||||
double d15 = socket1.async_receive(mutable_buffers, dlazy);
|
||||
(void)d15;
|
||||
double d16 = socket1.async_receive(null_buffers(), dlazy);
|
||||
(void)d16;
|
||||
double d17 = socket1.async_receive(buffer(mutable_char_buffer), in_flags,
|
||||
dlazy);
|
||||
(void)d17;
|
||||
double d18 = socket1.async_receive(mutable_buffers, in_flags, dlazy);
|
||||
(void)d18;
|
||||
double d19 = socket1.async_receive(null_buffers(), in_flags, dlazy);
|
||||
(void)d19;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
socket1.write_some(buffer(mutable_char_buffer));
|
||||
socket1.write_some(buffer(const_char_buffer));
|
||||
@ -483,6 +537,18 @@ void test()
|
||||
(void)i23;
|
||||
int i24 = socket1.async_write_some(null_buffers(), lazy);
|
||||
(void)i24;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d20 = socket1.async_write_some(buffer(mutable_char_buffer), dlazy);
|
||||
(void)d20;
|
||||
double d21 = socket1.async_write_some(buffer(const_char_buffer), dlazy);
|
||||
(void)d21;
|
||||
double d22 = socket1.async_write_some(mutable_buffers, dlazy);
|
||||
(void)d22;
|
||||
double d23 = socket1.async_write_some(const_buffers, dlazy);
|
||||
(void)d23;
|
||||
double d24 = socket1.async_write_some(null_buffers(), dlazy);
|
||||
(void)d24;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
socket1.read_some(buffer(mutable_char_buffer));
|
||||
socket1.read_some(mutable_buffers);
|
||||
@ -500,6 +566,14 @@ void test()
|
||||
(void)i26;
|
||||
int i27 = socket1.async_read_some(null_buffers(), lazy);
|
||||
(void)i27;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d25 = socket1.async_read_some(buffer(mutable_char_buffer), dlazy);
|
||||
(void)d25;
|
||||
double d26 = socket1.async_read_some(mutable_buffers, dlazy);
|
||||
(void)d26;
|
||||
double d27 = socket1.async_read_some(null_buffers(), dlazy);
|
||||
(void)d27;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
@ -732,6 +806,9 @@ void test()
|
||||
archetypes::gettable_socket_option<double> gettable_socket_option3;
|
||||
archetypes::io_control_command io_control_command;
|
||||
archetypes::lazy_handler lazy;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
archetypes::deprecated_lazy_handler dlazy;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
asio::error_code ec;
|
||||
|
||||
// basic_socket_acceptor constructors.
|
||||
@ -833,6 +910,10 @@ void test()
|
||||
acceptor1.async_wait(socket_base::wait_read, wait_handler());
|
||||
int i1 = acceptor1.async_wait(socket_base::wait_write, lazy);
|
||||
(void)i1;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d1 = acceptor1.async_wait(socket_base::wait_write, dlazy);
|
||||
(void)d1;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
acceptor1.accept(peer_socket);
|
||||
acceptor1.accept(peer_socket, ec);
|
||||
@ -853,6 +934,12 @@ void test()
|
||||
(void)i2;
|
||||
int i3 = acceptor1.async_accept(peer_socket, peer_endpoint, lazy);
|
||||
(void)i3;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d2 = acceptor1.async_accept(peer_socket, dlazy);
|
||||
(void)d2;
|
||||
double d3 = acceptor1.async_accept(peer_socket, peer_endpoint, dlazy);
|
||||
(void)d3;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
acceptor1.async_accept(move_accept_handler());
|
||||
@ -977,6 +1064,9 @@ void test()
|
||||
{
|
||||
io_context ioc;
|
||||
archetypes::lazy_handler lazy;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
archetypes::deprecated_lazy_handler dlazy;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
asio::error_code ec;
|
||||
ip::tcp::resolver::query q(ip::tcp::v4(), "localhost", "0");
|
||||
ip::tcp::endpoint e(ip::address_v4::loopback(), 0);
|
||||
@ -1071,6 +1161,34 @@ void test()
|
||||
resolver.async_resolve(e, resolve_handler());
|
||||
int i6 = resolver.async_resolve(e, lazy);
|
||||
(void)i6;
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d1 = resolver.async_resolve(q, dlazy);
|
||||
(void)d1;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d2 = resolver.async_resolve("", "", dlazy);
|
||||
(void)d2;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d3 = resolver.async_resolve("", "",
|
||||
ip::tcp::resolver::flags(), dlazy);
|
||||
(void)d3;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d4 = resolver.async_resolve(ip::tcp::v4(), "", "", dlazy);
|
||||
(void)d4;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d5 = resolver.async_resolve(ip::tcp::v4(),
|
||||
"", "", ip::tcp::resolver::flags(), dlazy);
|
||||
(void)d5;
|
||||
|
||||
resolver.async_resolve(e, resolve_handler());
|
||||
double d6 = resolver.async_resolve(e, dlazy);
|
||||
(void)d6;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
|
@ -19,8 +19,9 @@
|
||||
#include <cstring>
|
||||
#include "asio/io_context.hpp"
|
||||
#include "../unit_test.hpp"
|
||||
#include "../archetypes/gettable_socket_option.hpp"
|
||||
#include "../archetypes/async_result.hpp"
|
||||
#include "../archetypes/deprecated_async_result.hpp"
|
||||
#include "../archetypes/gettable_socket_option.hpp"
|
||||
#include "../archetypes/io_control_command.hpp"
|
||||
#include "../archetypes/settable_socket_option.hpp"
|
||||
|
||||
@ -102,6 +103,9 @@ void test()
|
||||
archetypes::gettable_socket_option<double> gettable_socket_option3;
|
||||
archetypes::io_control_command io_control_command;
|
||||
archetypes::lazy_handler lazy;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
archetypes::deprecated_lazy_handler dlazy;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
asio::error_code ec;
|
||||
|
||||
// basic_datagram_socket constructors.
|
||||
@ -201,6 +205,14 @@ void test()
|
||||
(void)i1;
|
||||
int i2 = socket1.async_connect(ip::udp::endpoint(ip::udp::v6(), 0), lazy);
|
||||
(void)i2;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d1 = socket1.async_connect(
|
||||
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
|
||||
(void)d1;
|
||||
double d2 = socket1.async_connect(
|
||||
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
|
||||
(void)d2;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
socket1.set_option(settable_socket_option1);
|
||||
socket1.set_option(settable_socket_option1, ec);
|
||||
@ -244,6 +256,10 @@ void test()
|
||||
socket1.async_wait(socket_base::wait_read, wait_handler());
|
||||
int i3 = socket1.async_wait(socket_base::wait_write, lazy);
|
||||
(void)i3;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d3 = socket1.async_wait(socket_base::wait_write, dlazy);
|
||||
(void)d3;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
// basic_datagram_socket functions.
|
||||
|
||||
@ -275,6 +291,21 @@ void test()
|
||||
(void)i8;
|
||||
int i9 = socket1.async_send(null_buffers(), in_flags, lazy);
|
||||
(void)i9;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d4 = socket1.async_send(buffer(mutable_char_buffer), dlazy);
|
||||
(void)d4;
|
||||
double d5 = socket1.async_send(buffer(const_char_buffer), dlazy);
|
||||
(void)d5;
|
||||
double d6 = socket1.async_send(null_buffers(), dlazy);
|
||||
(void)d6;
|
||||
double d7 = socket1.async_send(
|
||||
buffer(mutable_char_buffer), in_flags, dlazy);
|
||||
(void)d7;
|
||||
double d8 = socket1.async_send(buffer(const_char_buffer), in_flags, dlazy);
|
||||
(void)d8;
|
||||
double d9 = socket1.async_send(null_buffers(), in_flags, dlazy);
|
||||
(void)d9;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
socket1.send_to(buffer(mutable_char_buffer),
|
||||
ip::udp::endpoint(ip::udp::v4(), 0));
|
||||
@ -373,6 +404,44 @@ void test()
|
||||
int i21 = socket1.async_send_to(null_buffers(),
|
||||
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, lazy);
|
||||
(void)i21;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d10 = socket1.async_send_to(buffer(mutable_char_buffer),
|
||||
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
|
||||
(void)d10;
|
||||
double d11 = socket1.async_send_to(buffer(mutable_char_buffer),
|
||||
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
|
||||
(void)d11;
|
||||
double d12 = socket1.async_send_to(buffer(const_char_buffer),
|
||||
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
|
||||
(void)d12;
|
||||
double d13 = socket1.async_send_to(buffer(const_char_buffer),
|
||||
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
|
||||
(void)d13;
|
||||
double d14 = socket1.async_send_to(null_buffers(),
|
||||
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
|
||||
(void)d14;
|
||||
double d15 = socket1.async_send_to(null_buffers(),
|
||||
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
|
||||
(void)d15;
|
||||
double d16 = socket1.async_send_to(buffer(mutable_char_buffer),
|
||||
ip::udp::endpoint(ip::udp::v4(), 0), in_flags, dlazy);
|
||||
(void)d16;
|
||||
double d17 = socket1.async_send_to(buffer(mutable_char_buffer),
|
||||
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, dlazy);
|
||||
(void)d17;
|
||||
double d18 = socket1.async_send_to(buffer(const_char_buffer),
|
||||
ip::udp::endpoint(ip::udp::v4(), 0), in_flags, dlazy);
|
||||
(void)d18;
|
||||
double d19 = socket1.async_send_to(buffer(const_char_buffer),
|
||||
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, dlazy);
|
||||
(void)d19;
|
||||
double d20 = socket1.async_send_to(null_buffers(),
|
||||
ip::udp::endpoint(ip::udp::v4(), 0), in_flags, dlazy);
|
||||
(void)d20;
|
||||
double d21 = socket1.async_send_to(null_buffers(),
|
||||
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, dlazy);
|
||||
(void)d21;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
socket1.receive(buffer(mutable_char_buffer));
|
||||
socket1.receive(null_buffers());
|
||||
@ -395,6 +464,17 @@ void test()
|
||||
(void)i24;
|
||||
int i25 = socket1.async_receive(null_buffers(), in_flags, lazy);
|
||||
(void)i25;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d22 = socket1.async_receive(buffer(mutable_char_buffer), dlazy);
|
||||
(void)d22;
|
||||
double d23 = socket1.async_receive(null_buffers(), dlazy);
|
||||
(void)d23;
|
||||
double d24 = socket1.async_receive(buffer(mutable_char_buffer),
|
||||
in_flags, dlazy);
|
||||
(void)d24;
|
||||
double d25 = socket1.async_receive(null_buffers(), in_flags, dlazy);
|
||||
(void)d25;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
ip::udp::endpoint endpoint;
|
||||
socket1.receive_from(buffer(mutable_char_buffer), endpoint);
|
||||
@ -424,6 +504,20 @@ void test()
|
||||
int i29 = socket1.async_receive_from(null_buffers(),
|
||||
endpoint, in_flags, lazy);
|
||||
(void)i29;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
double d26 = socket1.async_receive_from(buffer(mutable_char_buffer),
|
||||
endpoint, dlazy);
|
||||
(void)d26;
|
||||
double d27 = socket1.async_receive_from(null_buffers(),
|
||||
endpoint, dlazy);
|
||||
(void)d27;
|
||||
double d28 = socket1.async_receive_from(buffer(mutable_char_buffer),
|
||||
endpoint, in_flags, dlazy);
|
||||
(void)d28;
|
||||
double d29 = socket1.async_receive_from(null_buffers(),
|
||||
endpoint, in_flags, dlazy);
|
||||
(void)d29;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
@ -533,6 +627,9 @@ void test()
|
||||
{
|
||||
io_context ioc;
|
||||
archetypes::lazy_handler lazy;
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
archetypes::deprecated_lazy_handler dlazy;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
asio::error_code ec;
|
||||
ip::udp::resolver::query q(ip::udp::v4(), "localhost", "0");
|
||||
ip::udp::endpoint e(ip::address_v4::loopback(), 0);
|
||||
@ -627,6 +724,34 @@ void test()
|
||||
resolver.async_resolve(e, resolve_handler());
|
||||
int i6 = resolver.async_resolve(e, lazy);
|
||||
(void)i6;
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d1 = resolver.async_resolve(q, dlazy);
|
||||
(void)d1;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d2 = resolver.async_resolve("", "", dlazy);
|
||||
(void)d2;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d3 = resolver.async_resolve("", "",
|
||||
ip::udp::resolver::flags(), dlazy);
|
||||
(void)d3;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d4 = resolver.async_resolve(ip::udp::v4(), "", "", dlazy);
|
||||
(void)d4;
|
||||
|
||||
resolver.async_resolve(q, resolve_handler());
|
||||
double d5 = resolver.async_resolve(ip::udp::v4(),
|
||||
"", "", ip::udp::resolver::flags(), dlazy);
|
||||
(void)d5;
|
||||
|
||||
resolver.async_resolve(e, resolve_handler());
|
||||
double d6 = resolver.async_resolve(e, dlazy);
|
||||
(void)d6;
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user