Replace BOOST_ASIO_INITFN_RESULT_TYPE with BOOST_ASIO_INITFN_AUTO_RESULT_TYPE

asio::deferred doesn't work with BOOST_ASIO_INITFN_RESULT_TYPE
Fixes #2727.
This commit is contained in:
Mohammad
2023-09-05 08:54:08 +03:30
committed by Mohammad Nejati
parent 35d533299c
commit 45d4f7f306
14 changed files with 107 additions and 42 deletions
@@ -31,11 +31,6 @@ template<class Executor>
template<class Handler, class Buffers>
class basic_stream<Executor>::read_op : public detail::stream_read_op_base
{
using ex1_type =
executor_type;
using ex2_type
= net::associated_executor_t<Handler, ex1_type>;
struct lambda
{
Handler h_;
@@ -44,7 +39,8 @@ class basic_stream<Executor>::read_op : public detail::stream_read_op_base
#if defined(BOOST_ASIO_NO_TS_EXECUTORS)
net::any_io_executor wg2_;
#else // defined(BOOST_ASIO_NO_TS_EXECUTORS)
net::executor_work_guard<ex2_type> wg2_;
net::executor_work_guard<
net::associated_executor_t<Handler, net::any_io_executor>> wg2_;
#endif // defined(BOOST_ASIO_NO_TS_EXECUTORS)
lambda(lambda&&) = default;
@@ -330,7 +326,7 @@ read_some(MutableBufferSequence const& buffers,
template<class Executor>
template<class MutableBufferSequence,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, std::size_t)) ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void(error_code, std::size_t))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler, void(error_code, std::size_t))
basic_stream<Executor>::
async_read_some(
MutableBufferSequence const& buffers,
@@ -414,7 +410,7 @@ write_some(
template<class Executor>
template<class ConstBufferSequence,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, std::size_t)) WriteHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void(error_code, std::size_t))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler, void(error_code, std::size_t))
basic_stream<Executor>::
async_write_some(
ConstBufferSequence const& buffers,
@@ -468,7 +468,7 @@ public:
class MutableBufferSequence,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, std::size_t)) ReadHandler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void(error_code, std::size_t))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler, void(error_code, std::size_t))
async_read_some(
MutableBufferSequence const& buffers,
ReadHandler&& handler BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type));
@@ -547,7 +547,7 @@ public:
class ConstBufferSequence,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, std::size_t)) WriteHandler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void(error_code, std::size_t))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler, void(error_code, std::size_t))
async_write_some(
ConstBufferSequence const& buffers,
WriteHandler&& handler BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)
+4 -4
View File
@@ -1022,7 +1022,7 @@ public:
EndpointSequence>::value>::type
#endif
>
BOOST_ASIO_INITFN_RESULT_TYPE(
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
RangeConnectHandler,
void(error_code, typename Protocol::endpoint))
async_connect(
@@ -1126,7 +1126,7 @@ public:
EndpointSequence>::value>::type
#endif
>
BOOST_ASIO_INITFN_RESULT_TYPE(
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
RangeConnectHandler,
void(error_code, typename Protocol::endpoint))
async_connect(
@@ -1195,7 +1195,7 @@ public:
void(error_code, Iterator))
IteratorConnectHandler =
net::default_completion_token_t<executor_type>>
BOOST_ASIO_INITFN_RESULT_TYPE(
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
IteratorConnectHandler,
void(error_code, Iterator))
async_connect(
@@ -1267,7 +1267,7 @@ public:
void(error_code, Iterator))
IteratorConnectHandler =
net::default_completion_token_t<executor_type>>
BOOST_ASIO_INITFN_RESULT_TYPE(
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
IteratorConnectHandler,
void(error_code, Iterator))
async_connect(
+3 -17
View File
@@ -319,19 +319,12 @@ template<
class CompletionToken =
net::default_completion_token_t<beast::executor_type<AsyncReadStream>>
>
#if BOOST_BEAST_DOXYGEN
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(error_code, bool))
#else
auto
#endif
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void(error_code, bool))
async_detect_ssl(
AsyncReadStream& stream,
DynamicBuffer& buffer,
CompletionToken&& token = net::default_completion_token_t<
beast::executor_type<AsyncReadStream>>{}) ->
typename net::async_result<
typename std::decay<CompletionToken>::type, /*< `async_result` customizes the return value based on the completion token >*/
void(error_code, bool)>::return_type; /*< This is the signature for the completion handler >*/
beast::executor_type<AsyncReadStream>>{});
//]
//[example_core_detect_ssl_5
@@ -395,18 +388,11 @@ template<
class AsyncReadStream,
class DynamicBuffer,
class CompletionToken>
#if BOOST_BEAST_DOXYGEN
BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void(error_code, bool))
#else
auto
#endif
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void(error_code, bool))
async_detect_ssl(
AsyncReadStream& stream,
DynamicBuffer& buffer,
CompletionToken&& token)
-> typename net::async_result<
typename std::decay<CompletionToken>::type,
void(error_code, bool)>::return_type
{
// Make sure arguments meet the type requirements
@@ -893,7 +893,7 @@ template<
class EndpointSequence,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, typename Protocol::endpoint)) RangeConnectHandler,
class>
BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,void(error_code, typename Protocol::endpoint))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(RangeConnectHandler,void(error_code, typename Protocol::endpoint))
basic_stream<Protocol, Executor, RatePolicy>::
async_connect(
EndpointSequence const& endpoints,
@@ -915,7 +915,7 @@ template<
class ConnectCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, typename Protocol::endpoint)) RangeConnectHandler,
class>
BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,void (error_code, typename Protocol::endpoint))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(RangeConnectHandler,void (error_code, typename Protocol::endpoint))
basic_stream<Protocol, Executor, RatePolicy>::
async_connect(
EndpointSequence const& endpoints,
@@ -936,7 +936,7 @@ template<class Protocol, class Executor, class RatePolicy>
template<
class Iterator,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, Iterator)) IteratorConnectHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,void (error_code, Iterator))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,void (error_code, Iterator))
basic_stream<Protocol, Executor, RatePolicy>::
async_connect(
Iterator begin, Iterator end,
@@ -957,7 +957,7 @@ template<
class Iterator,
class ConnectCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, Iterator)) IteratorConnectHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,void (error_code, Iterator))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,void (error_code, Iterator))
basic_stream<Protocol, Executor, RatePolicy>::
async_connect(
Iterator begin, Iterator end,
+5 -5
View File
@@ -412,7 +412,7 @@ public:
); @endcode
*/
template<BOOST_BEAST_ASYNC_TPARAM1 HandshakeHandler = net::default_completion_token_t<executor_type>>
BOOST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, void(boost::system::error_code))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(HandshakeHandler, void(boost::system::error_code))
async_handshake(handshake_type type,
BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler = net::default_completion_token_t<executor_type>{})
{
@@ -443,7 +443,7 @@ public:
*/
template<class ConstBufferSequence,
BOOST_BEAST_ASYNC_TPARAM2 BufferedHandshakeHandler = net::default_completion_token_t<executor_type>>
BOOST_ASIO_INITFN_RESULT_TYPE(BufferedHandshakeHandler, void(boost::system::error_code, std::size_t))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(BufferedHandshakeHandler, void(boost::system::error_code, std::size_t))
async_handshake(handshake_type type, ConstBufferSequence const& buffers,
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler
= net::default_completion_token_t<executor_type>{})
@@ -491,7 +491,7 @@ public:
); @endcode
*/
template<BOOST_BEAST_ASYNC_TPARAM1 ShutdownHandler = net::default_completion_token_t<executor_type>>
BOOST_ASIO_INITFN_RESULT_TYPE(ShutdownHandler, void(boost::system::error_code))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ShutdownHandler, void(boost::system::error_code))
async_shutdown(BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler = net::default_completion_token_t<executor_type>{})
{
return p_->next_layer().async_shutdown(
@@ -570,7 +570,7 @@ public:
*/
template<class ConstBufferSequence,
BOOST_BEAST_ASYNC_TPARAM2 WriteHandler = net::default_completion_token_t<executor_type>>
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void(boost::system::error_code, std::size_t))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler, void(boost::system::error_code, std::size_t))
async_write_some(ConstBufferSequence const& buffers,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler= net::default_completion_token_t<executor_type>{})
{
@@ -652,7 +652,7 @@ public:
*/
template<class MutableBufferSequence,
BOOST_BEAST_ASYNC_TPARAM2 ReadHandler = net::default_completion_token_t<executor_type>>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void(boost::system::error_code, std::size_t))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler, void(boost::system::error_code, std::size_t))
async_read_some(MutableBufferSequence const& buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler
= net::default_completion_token_t<executor_type>{})