diff --git a/CHANGELOG.md b/CHANGELOG.md index 1522acc4..2bc4d506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ API Changes * Return http::error::end_of_stream on HTTP read eof * Remove placeholders * Move prepare_buffers to prepare_buffer.hpp +* Replace asynchronous helper macros with template aliases -------------------------------------------------------------------------------- diff --git a/doc/quickref.xml b/doc/quickref.xml index c006e14e..0f1fdf5c 100644 --- a/doc/quickref.xml +++ b/doc/quickref.xml @@ -153,6 +153,7 @@ async_completion async_result + async_return_type basic_flat_buffer basic_multi_buffer buffers_adapter @@ -165,6 +166,7 @@ flat_buffer handler_alloc handler_ptr + handler_type multi_buffer static_buffer static_buffer_n @@ -185,11 +187,6 @@ system_category to_static_string - Macros - - BEAST_HANDLER_TYPE - BEAST_INITFN_RESULT_TYPE - Type Traits diff --git a/extras/beast/test/fail_stream.hpp b/extras/beast/test/fail_stream.hpp index fedd0033..33e431e9 100644 --- a/extras/beast/test/fail_stream.hpp +++ b/extras/beast/test/fail_stream.hpp @@ -103,8 +103,8 @@ public: } template - BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code, std::size_t)) + async_return_type< + ReadHandler, void(error_code, std::size_t)> async_read_some(MutableBufferSequence const& buffers, ReadHandler&& handler) { @@ -139,8 +139,8 @@ public: } template - BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code, std::size_t)) + async_return_type< + WriteHandler, void(error_code, std::size_t)> async_write_some(ConstBufferSequence const& buffers, WriteHandler&& handler) { diff --git a/extras/beast/test/string_iostream.hpp b/extras/beast/test/string_iostream.hpp index 29fc9e56..d7c03008 100644 --- a/extras/beast/test/string_iostream.hpp +++ b/extras/beast/test/string_iostream.hpp @@ -78,8 +78,8 @@ public: } template - BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code, std::size_t)) + async_return_type< + ReadHandler, void(error_code, std::size_t)> async_read_some(MutableBufferSequence const& buffers, ReadHandler&& handler) { @@ -124,8 +124,8 @@ public: } template - BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code, std::size_t)) + async_return_type< + WriteHandler, void(error_code, std::size_t)> async_write_some(ConstBufferSequence const& buffers, WriteHandler&& handler) { diff --git a/extras/beast/test/string_istream.hpp b/extras/beast/test/string_istream.hpp index 3f3dcc37..0f030128 100644 --- a/extras/beast/test/string_istream.hpp +++ b/extras/beast/test/string_istream.hpp @@ -76,8 +76,8 @@ public: } template - BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code, std::size_t)) + async_return_type< + ReadHandler, void(error_code, std::size_t)> async_read_some(MutableBufferSequence const& buffers, ReadHandler&& handler) { @@ -115,8 +115,8 @@ public: } template - BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code, std::size_t)) + async_return_type< + WriteHandler, void(error_code, std::size_t)> async_write_some(ConstBuffeSequence const& buffers, WriteHandler&& handler) { diff --git a/extras/beast/test/string_ostream.hpp b/extras/beast/test/string_ostream.hpp index c59bfc9b..4c08bd21 100644 --- a/extras/beast/test/string_ostream.hpp +++ b/extras/beast/test/string_ostream.hpp @@ -59,8 +59,8 @@ public: } template - BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code, std::size_t)) + async_return_type< + ReadHandler, void(error_code, std::size_t)> async_read_some(MutableBufferSequence const& buffers, ReadHandler&& handler) { @@ -98,8 +98,8 @@ public: } template - BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code, std::size_t)) + async_return_type< + WriteHandler, void(error_code, std::size_t)> async_write_some(ConstBufferSequence const& buffers, WriteHandler&& handler) { diff --git a/include/beast/core/async_result.hpp b/include/beast/core/async_result.hpp index 9fadabb9..28889a27 100644 --- a/include/beast/core/async_result.hpp +++ b/include/beast/core/async_result.hpp @@ -37,7 +37,7 @@ namespace beast { completion token types. The primary template assumes that the @b CompletionToken is the completion handler. - @see @ref BEAST_INITFN_RESULT_TYPE, @ref BEAST_HANDLER_TYPE + @see @ref async_completion, @ref async_return_type, @ref handler_type */ template class async_result @@ -118,6 +118,8 @@ public: @note See Working Draft, C++ Extensions for Networking + + @see @ref async_return_type, @ref handler_type */ template struct async_completion @@ -150,7 +152,7 @@ struct async_completion // CompletionToken is not invokable with the given signature static_assert(is_CompletionHandler< completion_handler_type, Signature>::value, - "CompletionToken requirements not met (Signature mismatch)"); + "CompletionToken requirements not met: signature mismatch"); } /// The final completion handler, callable with the specified signature. @@ -165,23 +167,41 @@ struct async_completion CompletionToken>::type, Signature> result; }; -/// @file +/** Convert a completion token to the correct completion handler type. -/** @def BEAST_INITFN_RESULT_TYPE(ct, sig) + This helps asynchronous initiation functions to meet the + requirements of the Extensible Asynchronous Model. - A macro to customize the return value of asynchronous initiation functions. + @tparam CompletionToken Specifies the model used to obtain the result of + the asynchronous operation. + + @tparam Signature The call signature for the completion handler type invoked + on completion of the asynchronous operation. + + @see @ref async_completion, @ref async_return_type */ -#define BEAST_INITFN_RESULT_TYPE(ct, sig) \ - typename async_result< \ - typename std::decay::type, sig>::return_type +template +using handler_type = typename beast::async_result< + typename std::decay::type, + Signature>::completion_handler_type; -/** @def BEAST_HANDLER_TYPE(ct, sig) +/** Determine the return value of an asynchronous initiation function - A helper macro to convert a completion token to a completion handler type. + This helps asynchronous initiation functions to meet the + requirements of the Extensible Asynchronous Model. + + @tparam CompletionToken Specifies the model used to obtain the result of + the asynchronous operation. + + @tparam Signature The call signature for the completion handler type invoked + on completion of the asynchronous operation. + + @see @ref async_completion, @ref handler_type */ -#define BEAST_HANDLER_TYPE(ct, sig) \ - typename async_result< \ - typename std::decay::type, sig>::completion_handler_type +template +using async_return_type = typename beast::async_result< + typename std::decay::type, + Signature>::return_type; } // beast diff --git a/include/beast/core/buffered_read_stream.hpp b/include/beast/core/buffered_read_stream.hpp index f264a037..fe380c71 100644 --- a/include/beast/core/buffered_read_stream.hpp +++ b/include/beast/core/buffered_read_stream.hpp @@ -272,7 +272,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE(ReadHandler, void(error_code)) + async_return_type async_read_some(MutableBufferSequence const& buffers, ReadHandler&& handler); @@ -343,7 +343,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE(WriteHandler, void(error_code)) + async_return_type async_write_some(ConstBufferSequence const& buffers, WriteHandler&& handler); }; diff --git a/include/beast/core/impl/buffered_read_stream.ipp b/include/beast/core/impl/buffered_read_stream.ipp index 9b36d7b9..f7c28915 100644 --- a/include/beast/core/impl/buffered_read_stream.ipp +++ b/include/beast/core/impl/buffered_read_stream.ipp @@ -162,7 +162,7 @@ auto buffered_read_stream:: async_write_some(ConstBufferSequence const& buffers, WriteHandler&& handler) -> - BEAST_INITFN_RESULT_TYPE(WriteHandler, void(error_code)) + async_return_type { static_assert(is_AsyncWriteStream::value, "AsyncWriteStream requirements not met"); @@ -230,7 +230,7 @@ auto buffered_read_stream:: async_read_some(MutableBufferSequence const& buffers, ReadHandler&& handler) -> - BEAST_INITFN_RESULT_TYPE(ReadHandler, void(error_code)) + async_return_type { static_assert(is_AsyncReadStream::value, "Stream requirements not met"); @@ -239,8 +239,8 @@ async_read_some(MutableBufferSequence const& buffers, "MutableBufferSequence requirements not met"); async_completion init{handler}; - read_some_op{ + read_some_op>{ init.completion_handler, *this, buffers}; return init.result.get(); } diff --git a/include/beast/http/impl/async_read.ipp b/include/beast/http/impl/async_read.ipp index f4a015a9..26d34dde 100644 --- a/include/beast/http/impl/async_read.ipp +++ b/include/beast/http/impl/async_read.ipp @@ -575,8 +575,8 @@ template< class DynamicBuffer, bool isRequest, class Derived, class ReadHandler> -BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code, std::size_t)) +async_return_type< + ReadHandler, void(error_code, std::size_t)> async_read_some( AsyncReadStream& stream, DynamicBuffer& dynabuf, @@ -590,15 +590,15 @@ async_read_some( case parse_state::header: case parse_state::chunk_header: detail::read_some_buffer_op{ + DynamicBuffer, isRequest, true, Derived, handler_type< + ReadHandler, void(error_code, std::size_t)>>{ init.completion_handler, stream, dynabuf, parser}; break; default: detail::read_some_body_op{ + DynamicBuffer, isRequest, Derived, handler_type< + ReadHandler, void(error_code, std::size_t)>>{ init.completion_handler, stream, dynabuf, parser}; break; } @@ -611,8 +611,8 @@ template< bool isRequest, class Derived, class ReadHandler> inline -BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code, std::size_t)) +async_return_type< + ReadHandler, void(error_code, std::size_t)> async_read_some( AsyncReadStream& stream, DynamicBuffer& dynabuf, @@ -622,8 +622,8 @@ async_read_some( async_completion init{handler}; detail::read_some_buffer_op{ + DynamicBuffer, isRequest, false, Derived, handler_type< + ReadHandler, void(error_code, std::size_t)>>{ init.completion_handler, stream, dynabuf, parser}; return init.result.get(); } @@ -637,8 +637,8 @@ template< class DynamicBuffer, bool isRequest, bool isDirect, class Derived, class ReadHandler> -BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code, std::size_t)) +async_return_type< + ReadHandler, void(error_code, std::size_t)> async_read_some( AsyncReadStream& stream, DynamicBuffer& dynabuf, @@ -659,8 +659,8 @@ template< class DynamicBuffer, bool isRequest, bool isDirect, class Derived, class ReadHandler> -BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code)) +async_return_type< + ReadHandler, void(error_code)> async_read( AsyncReadStream& stream, DynamicBuffer& dynabuf, @@ -675,8 +675,8 @@ async_read( async_completion init{handler}; detail::parse_op{ + isRequest, isDirect, Derived, handler_type< + ReadHandler, void(error_code)>>{ init.completion_handler, stream, dynabuf, parser}; return init.result.get(); } @@ -686,8 +686,8 @@ template< class DynamicBuffer, bool isRequest, class Body, class Fields, class ReadHandler> -BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code)) +async_return_type< + ReadHandler, void(error_code)> async_read( AsyncReadStream& stream, DynamicBuffer& dynabuf, @@ -708,8 +708,8 @@ async_read( async_completion init{handler}; detail::read_message_op{ + isRequest, Body, Fields, handler_type< + ReadHandler, void(error_code)>>{ init.completion_handler, stream, dynabuf, msg}; return init.result.get(); } diff --git a/include/beast/http/impl/write.ipp b/include/beast/http/impl/write.ipp index 466845a0..0d253439 100644 --- a/include/beast/http/impl/write.ipp +++ b/include/beast/http/impl/write.ipp @@ -213,8 +213,8 @@ write(SyncWriteStream& stream, template -BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) +async_return_type< + WriteHandler, void(error_code)> async_write(AsyncWriteStream& stream, header const& msg, WriteHandler&& handler) @@ -231,7 +231,7 @@ async_write(AsyncWriteStream& stream, os << "\r\n"; } detail::write_streambuf_op{ + handler_type>{ init.completion_handler, stream, std::move(b)}; return init.result.get(); } @@ -641,8 +641,8 @@ write(SyncWriteStream& stream, template -BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) +async_return_type< + WriteHandler, void(error_code)> async_write(AsyncWriteStream& stream, message const& msg, WriteHandler&& handler) @@ -658,8 +658,8 @@ async_write(AsyncWriteStream& stream, "Writer requirements not met"); async_completion init{handler}; - detail::write_op, isRequest, Body, Fields>{init.completion_handler, stream, msg}; return init.result.get(); } diff --git a/include/beast/http/read.hpp b/include/beast/http/read.hpp index 187bbdb9..0750fcb7 100644 --- a/include/beast/http/read.hpp +++ b/include/beast/http/read.hpp @@ -194,8 +194,8 @@ template< class DynamicBuffer, bool isRequest, bool isDirect, class Derived, class ReadHandler> -BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code, std::size_t)) +async_return_type< + ReadHandler, void(error_code, std::size_t)> async_read_some( AsyncReadStream& stream, DynamicBuffer& dynabuf, @@ -344,8 +344,8 @@ template< class DynamicBuffer, bool isRequest, bool isDirect, class Derived, class ReadHandler> -BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code)) +async_return_type< + ReadHandler, void(error_code)> async_read( AsyncReadStream& stream, DynamicBuffer& dynabuf, @@ -499,8 +499,8 @@ template< class DynamicBuffer, bool isRequest, class Body, class Fields, class ReadHandler> -BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code)) +async_return_type< + ReadHandler, void(error_code)> async_read( AsyncReadStream& stream, DynamicBuffer& dynabuf, diff --git a/include/beast/http/write.hpp b/include/beast/http/write.hpp index 3ec810db..de816b54 100644 --- a/include/beast/http/write.hpp +++ b/include/beast/http/write.hpp @@ -121,8 +121,8 @@ write(SyncWriteStream& stream, template -BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) +async_return_type< + WriteHandler, void(error_code)> async_write(AsyncWriteStream& stream, header const& msg, WriteHandler&& handler); @@ -236,8 +236,8 @@ write(SyncWriteStream& stream, template -BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) +async_return_type< + WriteHandler, void(error_code)> async_write(AsyncWriteStream& stream, message const& msg, WriteHandler&& handler); diff --git a/include/beast/websocket/impl/accept.ipp b/include/beast/websocket/impl/accept.ipp index 7d632975..43b7fae4 100644 --- a/include/beast/websocket/impl/accept.ipp +++ b/include/beast/websocket/impl/accept.ipp @@ -590,8 +590,8 @@ accept_ex(http::header const& req, template template -BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) +async_return_type< + AcceptHandler, void(error_code)> stream:: async_accept(AcceptHandler&& handler) { @@ -601,15 +601,15 @@ async_accept(AcceptHandler&& handler) void(error_code)> init{handler}; reset(); accept_op{ + handler_type>{ init.completion_handler, *this, &default_decorate_res}; return init.result.get(); } template template -BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) +async_return_type< + AcceptHandler, void(error_code)> stream:: async_accept_ex(ResponseDecorator const& decorator, AcceptHandler&& handler) @@ -622,16 +622,16 @@ async_accept_ex(ResponseDecorator const& decorator, async_completion init{handler}; reset(); - accept_op{ + accept_op>{ init.completion_handler, *this, decorator}; return init.result.get(); } template template -BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) +async_return_type< + AcceptHandler, void(error_code)> stream:: async_accept(ConstBufferSequence const& buffers, AcceptHandler&& handler) @@ -645,7 +645,7 @@ async_accept(ConstBufferSequence const& buffers, void(error_code)> init{handler}; reset(); accept_op{ + handler_type>{ init.completion_handler, *this, buffers, &default_decorate_res}; return init.result.get(); } @@ -653,8 +653,8 @@ async_accept(ConstBufferSequence const& buffers, template template -BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) +async_return_type< + AcceptHandler, void(error_code)> stream:: async_accept_ex(ConstBufferSequence const& buffers, ResponseDecorator const& decorator, @@ -671,16 +671,16 @@ async_accept_ex(ConstBufferSequence const& buffers, async_completion init{handler}; reset(); - accept_op{ + accept_op>{ init.completion_handler, *this, buffers, decorator}; return init.result.get(); } template template -BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) +async_return_type< + AcceptHandler, void(error_code)> stream:: async_accept(http::header const& req, AcceptHandler&& handler) @@ -690,8 +690,8 @@ async_accept(http::header const& req, async_completion init{handler}; reset(); - response_op{init.completion_handler, + response_op>{init.completion_handler, *this, req, &default_decorate_res, beast_asio_helpers::is_continuation( init.completion_handler)}; @@ -701,8 +701,8 @@ async_accept(http::header const& req, template template -BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) +async_return_type< + AcceptHandler, void(error_code)> stream:: async_accept_ex(http::header const& req, ResponseDecorator const& decorator, AcceptHandler&& handler) @@ -715,8 +715,8 @@ async_accept_ex(http::header const& req, async_completion init{handler}; reset(); - response_op{ + response_op>{ init.completion_handler, *this, req, decorator, beast_asio_helpers::is_continuation( init.completion_handler)}; @@ -726,8 +726,8 @@ async_accept_ex(http::header const& req, template template -BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) +async_return_type< + AcceptHandler, void(error_code)> stream:: async_accept(http::header const& req, ConstBufferSequence const& buffers, @@ -741,8 +741,8 @@ async_accept(http::header const& req, async_completion init{handler}; reset(); - response_op{ + response_op>{ init.completion_handler, *this, req, buffers, &default_decorate_res, beast_asio_helpers:: is_continuation(init.completion_handler)}; @@ -752,8 +752,8 @@ async_accept(http::header const& req, template template -BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) +async_return_type< + AcceptHandler, void(error_code)> stream:: async_accept_ex(http::header const& req, ConstBufferSequence const& buffers, @@ -771,8 +771,8 @@ async_accept_ex(http::header const& req, async_completion init{handler}; reset(); - response_op{init.completion_handler, + response_op>{init.completion_handler, *this, req, buffers, decorator, beast_asio_helpers::is_continuation( init.completion_handler)}; diff --git a/include/beast/websocket/impl/close.ipp b/include/beast/websocket/impl/close.ipp index b5e6fa2a..ff631bde 100644 --- a/include/beast/websocket/impl/close.ipp +++ b/include/beast/websocket/impl/close.ipp @@ -197,8 +197,8 @@ upcall: template template -BEAST_INITFN_RESULT_TYPE( - CloseHandler, void(error_code)) +async_return_type< + CloseHandler, void(error_code)> stream:: async_close(close_reason const& cr, CloseHandler&& handler) { @@ -206,8 +206,8 @@ async_close(close_reason const& cr, CloseHandler&& handler) "AsyncStream requirements not met"); async_completion init{handler}; - close_op{ + close_op>{ init.completion_handler, *this, cr}; return init.result.get(); } diff --git a/include/beast/websocket/impl/handshake.ipp b/include/beast/websocket/impl/handshake.ipp index fec3007b..f336598a 100644 --- a/include/beast/websocket/impl/handshake.ipp +++ b/include/beast/websocket/impl/handshake.ipp @@ -160,8 +160,8 @@ operator()(error_code ec, bool again) template template -BEAST_INITFN_RESULT_TYPE( - HandshakeHandler, void(error_code)) +async_return_type< + HandshakeHandler, void(error_code)> stream:: async_handshake(string_view const& host, string_view const& target, @@ -171,8 +171,8 @@ async_handshake(string_view const& host, "AsyncStream requirements not met"); async_completion init{handler}; - handshake_op{ + handshake_op>{ init.completion_handler, *this, nullptr, host, target, &default_decorate_req}; return init.result.get(); @@ -180,8 +180,8 @@ async_handshake(string_view const& host, template template -BEAST_INITFN_RESULT_TYPE( - HandshakeHandler, void(error_code)) +async_return_type< + HandshakeHandler, void(error_code)> stream:: async_handshake(response_type& res, string_view const& host, @@ -192,8 +192,8 @@ async_handshake(response_type& res, "AsyncStream requirements not met"); async_completion init{handler}; - handshake_op{ + handshake_op>{ init.completion_handler, *this, &res, host, target, &default_decorate_req}; return init.result.get(); @@ -201,8 +201,8 @@ async_handshake(response_type& res, template template -BEAST_INITFN_RESULT_TYPE( - HandshakeHandler, void(error_code)) +async_return_type< + HandshakeHandler, void(error_code)> stream:: async_handshake_ex(string_view const& host, string_view const& target, @@ -216,8 +216,8 @@ async_handshake_ex(string_view const& host, "RequestDecorator requirements not met"); async_completion init{handler}; - handshake_op{ + handshake_op>{ init.completion_handler, *this, nullptr, host, target, decorator}; return init.result.get(); @@ -225,8 +225,8 @@ async_handshake_ex(string_view const& host, template template -BEAST_INITFN_RESULT_TYPE( - HandshakeHandler, void(error_code)) +async_return_type< + HandshakeHandler, void(error_code)> stream:: async_handshake_ex(response_type& res, string_view const& host, @@ -241,8 +241,8 @@ async_handshake_ex(response_type& res, "RequestDecorator requirements not met"); async_completion init{handler}; - handshake_op{ + handshake_op>{ init.completion_handler, *this, &res, host, target, decorator}; return init.result.get(); diff --git a/include/beast/websocket/impl/ping.ipp b/include/beast/websocket/impl/ping.ipp index 52df2b02..49e8a6eb 100644 --- a/include/beast/websocket/impl/ping.ipp +++ b/include/beast/websocket/impl/ping.ipp @@ -195,8 +195,8 @@ upcall: template template -BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) +async_return_type< + WriteHandler, void(error_code)> stream:: async_ping(ping_data const& payload, WriteHandler&& handler) { @@ -204,16 +204,16 @@ async_ping(ping_data const& payload, WriteHandler&& handler) "AsyncStream requirements requirements not met"); async_completion init{handler}; - ping_op{ + ping_op>{ init.completion_handler, *this, opcode::ping, payload}; return init.result.get(); } template template -BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) +async_return_type< + WriteHandler, void(error_code)> stream:: async_pong(ping_data const& payload, WriteHandler&& handler) { @@ -221,8 +221,8 @@ async_pong(ping_data const& payload, WriteHandler&& handler) "AsyncStream requirements requirements not met"); async_completion init{handler}; - ping_op{ + ping_op>{ init.completion_handler, *this, opcode::pong, payload}; return init.result.get(); } diff --git a/include/beast/websocket/impl/read.ipp b/include/beast/websocket/impl/read.ipp index 598cb397..07a7ebc0 100644 --- a/include/beast/websocket/impl/read.ipp +++ b/include/beast/websocket/impl/read.ipp @@ -686,8 +686,8 @@ upcall: template template -BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code)) +async_return_type< + ReadHandler, void(error_code)> stream:: async_read_frame(frame_info& fi, DynamicBuffer& dynabuf, ReadHandler&& handler) @@ -698,8 +698,8 @@ async_read_frame(frame_info& fi, "DynamicBuffer requirements not met"); async_completion init{handler}; - read_frame_op{init.completion_handler, + read_frame_op>{init.completion_handler, *this, fi, dynabuf}; return init.result.get(); } @@ -1098,8 +1098,8 @@ upcall: template template -BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code)) +async_return_type< + ReadHandler, void(error_code)> stream:: async_read(opcode& op, DynamicBuffer& dynabuf, ReadHandler&& handler) @@ -1110,8 +1110,8 @@ async_read(opcode& op, "DynamicBuffer requirements not met"); async_completion init{handler}; - read_op{init.completion_handler, + read_op>{init.completion_handler, *this, op, dynabuf}; return init.result.get(); } diff --git a/include/beast/websocket/impl/write.ipp b/include/beast/websocket/impl/write.ipp index 7387a452..b325e992 100644 --- a/include/beast/websocket/impl/write.ipp +++ b/include/beast/websocket/impl/write.ipp @@ -545,8 +545,8 @@ upcall: template template -BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) +async_return_type< + WriteHandler, void(error_code)> stream:: async_write_frame(bool fin, ConstBufferSequence const& bs, WriteHandler&& handler) @@ -558,8 +558,8 @@ async_write_frame(bool fin, "ConstBufferSequence requirements not met"); async_completion init{handler}; - write_frame_op{init.completion_handler, + write_frame_op>{init.completion_handler, *this, fin, bs}; return init.result.get(); } @@ -895,8 +895,8 @@ operator()(error_code ec, bool again) template template -BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) +async_return_type< + WriteHandler, void(error_code)> stream:: async_write(ConstBufferSequence const& bs, WriteHandler&& handler) { @@ -907,8 +907,8 @@ async_write(ConstBufferSequence const& bs, WriteHandler&& handler) "ConstBufferSequence requirements not met"); async_completion init{handler}; - write_op{ + write_op>{ init.completion_handler, *this, bs}; return init.result.get(); } diff --git a/include/beast/websocket/stream.hpp b/include/beast/websocket/stream.hpp index f00f7838..f2ba705d 100644 --- a/include/beast/websocket/stream.hpp +++ b/include/beast/websocket/stream.hpp @@ -970,8 +970,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) + async_return_type< + AcceptHandler, void(error_code)> async_accept(AcceptHandler&& handler); /** Start reading and responding to a WebSocket HTTP Upgrade request. @@ -1025,8 +1025,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) + async_return_type< + AcceptHandler, void(error_code)> async_accept_ex(ResponseDecorator const& decorator, AcceptHandler&& handler); @@ -1079,8 +1079,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) + async_return_type< + AcceptHandler, void(error_code)> async_accept(ConstBufferSequence const& buffers, AcceptHandler&& handler); @@ -1143,8 +1143,8 @@ public: */ template - BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) + async_return_type< + AcceptHandler, void(error_code)> async_accept_ex(ConstBufferSequence const& buffers, ResponseDecorator const& decorator, AcceptHandler&& handler); @@ -1195,8 +1195,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) + async_return_type< + AcceptHandler, void(error_code)> async_accept(http::header const& req, AcceptHandler&& handler); @@ -1256,8 +1256,8 @@ public: */ template - BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) + async_return_type< + AcceptHandler, void(error_code)> async_accept_ex(http::header const& req, ResponseDecorator const& decorator, AcceptHandler&& handler); @@ -1316,8 +1316,8 @@ public: */ template - BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) + async_return_type< + AcceptHandler, void(error_code)> async_accept(http::header const& req, ConstBufferSequence const& buffers, AcceptHandler&& handler); @@ -1385,8 +1385,8 @@ public: */ template - BEAST_INITFN_RESULT_TYPE( - AcceptHandler, void(error_code)) + async_return_type< + AcceptHandler, void(error_code)> async_accept_ex(http::header const& req, ConstBufferSequence const& buffers, ResponseDecorator const& decorator, @@ -1863,8 +1863,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - HandshakeHandler, void(error_code)) + async_return_type< + HandshakeHandler, void(error_code)> async_handshake(string_view const& host, string_view const& target, HandshakeHandler&& handler); @@ -1915,8 +1915,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - HandshakeHandler, void(error_code)) + async_return_type< + HandshakeHandler, void(error_code)> async_handshake(response_type& res, string_view const& host, string_view const& target, @@ -1973,8 +1973,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - HandshakeHandler, void(error_code)) + async_return_type< + HandshakeHandler, void(error_code)> async_handshake_ex(string_view const& host, string_view const& target, RequestDecorator const& decorator, @@ -2035,8 +2035,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - HandshakeHandler, void(error_code)) + async_return_type< + HandshakeHandler, void(error_code)> async_handshake_ex(response_type& res, string_view const& host, string_view const& target, @@ -2145,8 +2145,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - CloseHandler, void(error_code)) + async_return_type< + CloseHandler, void(error_code)> async_close(close_reason const& cr, CloseHandler&& handler); /** Send a WebSocket ping frame. @@ -2223,8 +2223,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) + async_return_type< + WriteHandler, void(error_code)> async_ping(ping_data const& payload, WriteHandler&& handler); /** Send a WebSocket pong frame. @@ -2316,8 +2316,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) + async_return_type< + WriteHandler, void(error_code)> async_pong(ping_data const& payload, WriteHandler&& handler); /** Read a message from the stream. @@ -2460,8 +2460,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code)) + async_return_type< + ReadHandler, void(error_code)> async_read(opcode& op, DynamicBuffer& dynabuf, ReadHandler&& handler); /** Read a message frame from the stream. @@ -2614,8 +2614,8 @@ public: manner equivalent to using boost::asio::io_service::post(). */ template - BEAST_INITFN_RESULT_TYPE( - ReadHandler, void(error_code)) + async_return_type< + ReadHandler, void(error_code)> async_read_frame(frame_info& fi, DynamicBuffer& dynabuf, ReadHandler&& handler); @@ -2736,8 +2736,8 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template - BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) + async_return_type< + WriteHandler, void(error_code)> async_write(ConstBufferSequence const& buffers, WriteHandler&& handler); @@ -2848,8 +2848,8 @@ public: ); @endcode */ template - BEAST_INITFN_RESULT_TYPE( - WriteHandler, void(error_code)) + async_return_type< + WriteHandler, void(error_code)> async_write_frame(bool fin, ConstBufferSequence const& buffers, WriteHandler&& handler);