Replace asynchronous helper macros with template aliases (API Change)

This commit is contained in:
Vinnie Falco committed 2017-07-20 08:12:16 -07:00
1 parent 043386aeb3
commit aa8a0a2a4b
20 files changed
+207 -189

No files matched your search

+30 -30
View File
@@ -590,8 +590,8 @@ accept_ex(http::header<true, Fields> const& req,
template<class NextLayer>
template<class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
stream<NextLayer>::
async_accept(AcceptHandler&& handler)
{
@@ -601,15 +601,15 @@ async_accept(AcceptHandler&& handler)
void(error_code)> init{handler};
reset();
accept_op<decltype(&default_decorate_res),
BEAST_HANDLER_TYPE(AcceptHandler, void(error_code))>{
handler_type<AcceptHandler, void(error_code)>>{
init.completion_handler, *this, &default_decorate_res};
return init.result.get();
}
template<class NextLayer>
template<class ResponseDecorator, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
stream<NextLayer>::
async_accept_ex(ResponseDecorator const& decorator,
AcceptHandler&& handler)
@@ -622,16 +622,16 @@ async_accept_ex(ResponseDecorator const& decorator,
async_completion<AcceptHandler,
void(error_code)> init{handler};
reset();
accept_op<ResponseDecorator, BEAST_HANDLER_TYPE(
AcceptHandler, void(error_code))>{
accept_op<ResponseDecorator, handler_type<
AcceptHandler, void(error_code)>>{
init.completion_handler, *this, decorator};
return init.result.get();
}
template<class NextLayer>
template<class ConstBufferSequence, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
stream<NextLayer>::
async_accept(ConstBufferSequence const& buffers,
AcceptHandler&& handler)
@@ -645,7 +645,7 @@ async_accept(ConstBufferSequence const& buffers,
void(error_code)> init{handler};
reset();
accept_op<decltype(&default_decorate_res),
BEAST_HANDLER_TYPE(AcceptHandler, void(error_code))>{
handler_type<AcceptHandler, void(error_code)>>{
init.completion_handler, *this, buffers, &default_decorate_res};
return init.result.get();
}
@@ -653,8 +653,8 @@ async_accept(ConstBufferSequence const& buffers,
template<class NextLayer>
template<class ConstBufferSequence,
class ResponseDecorator, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
stream<NextLayer>::
async_accept_ex(ConstBufferSequence const& buffers,
ResponseDecorator const& decorator,
@@ -671,16 +671,16 @@ async_accept_ex(ConstBufferSequence const& buffers,
async_completion<AcceptHandler,
void(error_code)> init{handler};
reset();
accept_op<ResponseDecorator, BEAST_HANDLER_TYPE(
AcceptHandler, void(error_code))>{
accept_op<ResponseDecorator, handler_type<
AcceptHandler, void(error_code)>>{
init.completion_handler, *this, buffers, decorator};
return init.result.get();
}
template<class NextLayer>
template<class Fields, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
stream<NextLayer>::
async_accept(http::header<true, Fields> const& req,
AcceptHandler&& handler)
@@ -690,8 +690,8 @@ async_accept(http::header<true, Fields> const& req,
async_completion<AcceptHandler,
void(error_code)> init{handler};
reset();
response_op<BEAST_HANDLER_TYPE(
AcceptHandler, void(error_code))>{init.completion_handler,
response_op<handler_type<
AcceptHandler, void(error_code)>>{init.completion_handler,
*this, req, &default_decorate_res,
beast_asio_helpers::is_continuation(
init.completion_handler)};
@@ -701,8 +701,8 @@ async_accept(http::header<true, Fields> const& req,
template<class NextLayer>
template<class Fields,
class ResponseDecorator, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
stream<NextLayer>::
async_accept_ex(http::header<true, Fields> const& req,
ResponseDecorator const& decorator, AcceptHandler&& handler)
@@ -715,8 +715,8 @@ async_accept_ex(http::header<true, Fields> const& req,
async_completion<AcceptHandler,
void(error_code)> init{handler};
reset();
response_op<BEAST_HANDLER_TYPE(
AcceptHandler, void(error_code))>{
response_op<handler_type<
AcceptHandler, void(error_code)>>{
init.completion_handler, *this, req, decorator,
beast_asio_helpers::is_continuation(
init.completion_handler)};
@@ -726,8 +726,8 @@ async_accept_ex(http::header<true, Fields> const& req,
template<class NextLayer>
template<class Fields,
class ConstBufferSequence, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
stream<NextLayer>::
async_accept(http::header<true, Fields> const& req,
ConstBufferSequence const& buffers,
@@ -741,8 +741,8 @@ async_accept(http::header<true, Fields> const& req,
async_completion<AcceptHandler,
void(error_code)> init{handler};
reset();
response_op<BEAST_HANDLER_TYPE(
AcceptHandler, void(error_code))>{
response_op<handler_type<
AcceptHandler, void(error_code)>>{
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<true, Fields> const& req,
template<class NextLayer>
template<class Fields, class ConstBufferSequence,
class ResponseDecorator, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
stream<NextLayer>::
async_accept_ex(http::header<true, Fields> const& req,
ConstBufferSequence const& buffers,
@@ -771,8 +771,8 @@ async_accept_ex(http::header<true, Fields> const& req,
async_completion<AcceptHandler,
void(error_code)> init{handler};
reset();
response_op<BEAST_HANDLER_TYPE(
AcceptHandler, void(error_code))>{init.completion_handler,
response_op<handler_type<
AcceptHandler, void(error_code)>>{init.completion_handler,
*this, req, buffers, decorator,
beast_asio_helpers::is_continuation(
init.completion_handler)};
+4 -4
View File
@@ -197,8 +197,8 @@ upcall:
template<class NextLayer>
template<class CloseHandler>
BEAST_INITFN_RESULT_TYPE(
CloseHandler, void(error_code))
async_return_type<
CloseHandler, void(error_code)>
stream<NextLayer>::
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<CloseHandler,
void(error_code)> init{handler};
close_op<BEAST_HANDLER_TYPE(
CloseHandler, void(error_code))>{
close_op<handler_type<
CloseHandler, void(error_code)>>{
init.completion_handler, *this, cr};
return init.result.get();
}
+16 -16
View File
@@ -160,8 +160,8 @@ operator()(error_code ec, bool again)
template<class NextLayer>
template<class HandshakeHandler>
BEAST_INITFN_RESULT_TYPE(
HandshakeHandler, void(error_code))
async_return_type<
HandshakeHandler, void(error_code)>
stream<NextLayer>::
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<HandshakeHandler,
void(error_code)> init{handler};
handshake_op<BEAST_HANDLER_TYPE(
HandshakeHandler, void(error_code))>{
handshake_op<handler_type<
HandshakeHandler, void(error_code)>>{
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<class NextLayer>
template<class HandshakeHandler>
BEAST_INITFN_RESULT_TYPE(
HandshakeHandler, void(error_code))
async_return_type<
HandshakeHandler, void(error_code)>
stream<NextLayer>::
async_handshake(response_type& res,
string_view const& host,
@@ -192,8 +192,8 @@ async_handshake(response_type& res,
"AsyncStream requirements not met");
async_completion<HandshakeHandler,
void(error_code)> init{handler};
handshake_op<BEAST_HANDLER_TYPE(
HandshakeHandler, void(error_code))>{
handshake_op<handler_type<
HandshakeHandler, void(error_code)>>{
init.completion_handler, *this, &res, host,
target, &default_decorate_req};
return init.result.get();
@@ -201,8 +201,8 @@ async_handshake(response_type& res,
template<class NextLayer>
template<class RequestDecorator, class HandshakeHandler>
BEAST_INITFN_RESULT_TYPE(
HandshakeHandler, void(error_code))
async_return_type<
HandshakeHandler, void(error_code)>
stream<NextLayer>::
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<HandshakeHandler,
void(error_code)> init{handler};
handshake_op<BEAST_HANDLER_TYPE(
HandshakeHandler, void(error_code))>{
handshake_op<handler_type<
HandshakeHandler, void(error_code)>>{
init.completion_handler, *this, nullptr, host,
target, decorator};
return init.result.get();
@@ -225,8 +225,8 @@ async_handshake_ex(string_view const& host,
template<class NextLayer>
template<class RequestDecorator, class HandshakeHandler>
BEAST_INITFN_RESULT_TYPE(
HandshakeHandler, void(error_code))
async_return_type<
HandshakeHandler, void(error_code)>
stream<NextLayer>::
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<HandshakeHandler,
void(error_code)> init{handler};
handshake_op<BEAST_HANDLER_TYPE(
HandshakeHandler, void(error_code))>{
handshake_op<handler_type<
HandshakeHandler, void(error_code)>>{
init.completion_handler, *this, &res, host,
target, decorator};
return init.result.get();
+8 -8
View File
@@ -195,8 +195,8 @@ upcall:
template<class NextLayer>
template<class WriteHandler>
BEAST_INITFN_RESULT_TYPE(
WriteHandler, void(error_code))
async_return_type<
WriteHandler, void(error_code)>
stream<NextLayer>::
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<WriteHandler,
void(error_code)> init{handler};
ping_op<BEAST_HANDLER_TYPE(
WriteHandler, void(error_code))>{
ping_op<handler_type<
WriteHandler, void(error_code)>>{
init.completion_handler, *this, opcode::ping, payload};
return init.result.get();
}
template<class NextLayer>
template<class WriteHandler>
BEAST_INITFN_RESULT_TYPE(
WriteHandler, void(error_code))
async_return_type<
WriteHandler, void(error_code)>
stream<NextLayer>::
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<WriteHandler,
void(error_code)> init{handler};
ping_op<BEAST_HANDLER_TYPE(
WriteHandler, void(error_code))>{
ping_op<handler_type<
WriteHandler, void(error_code)>>{
init.completion_handler, *this, opcode::pong, payload};
return init.result.get();
}
+8 -8
View File
@@ -686,8 +686,8 @@ upcall:
template<class NextLayer>
template<class DynamicBuffer, class ReadHandler>
BEAST_INITFN_RESULT_TYPE(
ReadHandler, void(error_code))
async_return_type<
ReadHandler, void(error_code)>
stream<NextLayer>::
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<ReadHandler,
void(error_code)> init{handler};
read_frame_op<DynamicBuffer, BEAST_HANDLER_TYPE(
ReadHandler, void(error_code))>{init.completion_handler,
read_frame_op<DynamicBuffer, handler_type<
ReadHandler, void(error_code)>>{init.completion_handler,
*this, fi, dynabuf};
return init.result.get();
}
@@ -1098,8 +1098,8 @@ upcall:
template<class NextLayer>
template<class DynamicBuffer, class ReadHandler>
BEAST_INITFN_RESULT_TYPE(
ReadHandler, void(error_code))
async_return_type<
ReadHandler, void(error_code)>
stream<NextLayer>::
async_read(opcode& op,
DynamicBuffer& dynabuf, ReadHandler&& handler)
@@ -1110,8 +1110,8 @@ async_read(opcode& op,
"DynamicBuffer requirements not met");
async_completion<ReadHandler,
void(error_code)> init{handler};
read_op<DynamicBuffer, BEAST_HANDLER_TYPE(
ReadHandler, void(error_code))>{init.completion_handler,
read_op<DynamicBuffer, handler_type<
ReadHandler, void(error_code)>>{init.completion_handler,
*this, op, dynabuf};
return init.result.get();
}
+8 -8
View File
@@ -545,8 +545,8 @@ upcall:
template<class NextLayer>
template<class ConstBufferSequence, class WriteHandler>
BEAST_INITFN_RESULT_TYPE(
WriteHandler, void(error_code))
async_return_type<
WriteHandler, void(error_code)>
stream<NextLayer>::
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<WriteHandler,
void(error_code)> init{handler};
write_frame_op<ConstBufferSequence, BEAST_HANDLER_TYPE(
WriteHandler, void(error_code))>{init.completion_handler,
write_frame_op<ConstBufferSequence, handler_type<
WriteHandler, void(error_code)>>{init.completion_handler,
*this, fin, bs};
return init.result.get();
}
@@ -895,8 +895,8 @@ operator()(error_code ec, bool again)
template<class NextLayer>
template<class ConstBufferSequence, class WriteHandler>
BEAST_INITFN_RESULT_TYPE(
WriteHandler, void(error_code))
async_return_type<
WriteHandler, void(error_code)>
stream<NextLayer>::
async_write(ConstBufferSequence const& bs, WriteHandler&& handler)
{
@@ -907,8 +907,8 @@ async_write(ConstBufferSequence const& bs, WriteHandler&& handler)
"ConstBufferSequence requirements not met");
async_completion<WriteHandler,
void(error_code)> init{handler};
write_op<ConstBufferSequence, BEAST_HANDLER_TYPE(
WriteHandler, void(error_code))>{
write_op<ConstBufferSequence, handler_type<
WriteHandler, void(error_code)>>{
init.completion_handler, *this, bs};
return init.result.get();
}
+38 -38
View File
@@ -970,8 +970,8 @@ public:
manner equivalent to using `boost::asio::io_service::post`.
*/
template<class AcceptHandler>
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<class ResponseDecorator, class AcceptHandler>
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<class ConstBufferSequence, class AcceptHandler>
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<class ConstBufferSequence,
class ResponseDecorator, class AcceptHandler>
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<class Fields, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
async_accept(http::header<true, Fields> const& req,
AcceptHandler&& handler);
@@ -1256,8 +1256,8 @@ public:
*/
template<class Fields,
class ResponseDecorator, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
async_accept_ex(http::header<true, Fields> const& req,
ResponseDecorator const& decorator,
AcceptHandler&& handler);
@@ -1316,8 +1316,8 @@ public:
*/
template<class Fields,
class ConstBufferSequence, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
async_accept(http::header<true, Fields> const& req,
ConstBufferSequence const& buffers,
AcceptHandler&& handler);
@@ -1385,8 +1385,8 @@ public:
*/
template<class Fields, class ConstBufferSequence,
class ResponseDecorator, class AcceptHandler>
BEAST_INITFN_RESULT_TYPE(
AcceptHandler, void(error_code))
async_return_type<
AcceptHandler, void(error_code)>
async_accept_ex(http::header<true, Fields> const& req,
ConstBufferSequence const& buffers,
ResponseDecorator const& decorator,
@@ -1863,8 +1863,8 @@ public:
manner equivalent to using `boost::asio::io_service::post`.
*/
template<class HandshakeHandler>
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<class HandshakeHandler>
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<class RequestDecorator, class HandshakeHandler>
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<class RequestDecorator, class HandshakeHandler>
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<class CloseHandler>
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<class WriteHandler>
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<class WriteHandler>
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<class DynamicBuffer, class ReadHandler>
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<class DynamicBuffer, class ReadHandler>
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<class ConstBufferSequence, class WriteHandler>
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<class ConstBufferSequence, class WriteHandler>
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);