forked from boostorg/beast
Replace uses of net::coroutine
with asio::coroutine
`asio::coroutine` is an extension, which is not part of the Networking TS, so the `net` alias is not appropriate in this case. Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ Version 259:
|
|||||||
* Move `char_buffer` into a separate file
|
* Move `char_buffer` into a separate file
|
||||||
* Fix coverage collection in AzP CI
|
* Fix coverage collection in AzP CI
|
||||||
* Improve performance of `http::string_to_verb`
|
* Improve performance of `http::string_to_verb`
|
||||||
|
* Replace uses of `net::coroutine` with `asio::coroutine`
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ async_echo (AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& token)
|
|||||||
This function is used to asynchronously read a line ending
|
This function is used to asynchronously read a line ending
|
||||||
in a newline (`"\n"`) from the stream, and then write
|
in a newline (`"\n"`) from the stream, and then write
|
||||||
it back.
|
it back.
|
||||||
|
|
||||||
This call always returns immediately. The asynchronous operation
|
This call always returns immediately. The asynchronous operation
|
||||||
will continue until one of the following conditions is true:
|
will continue until one of the following conditions is true:
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ async_echo (AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& token)
|
|||||||
beast::error_code error // Result of operation.
|
beast::error_code error // Result of operation.
|
||||||
);
|
);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
Regardless of whether the asynchronous operation completes immediately or
|
Regardless of whether the asynchronous operation completes immediately or
|
||||||
not, the handler will not be invoked from within this function. Invocation
|
not, the handler will not be invoked from within this function. Invocation
|
||||||
of the handler will be performed in a manner equivalent to using
|
of the handler will be performed in a manner equivalent to using
|
||||||
@@ -161,10 +161,10 @@ async_echo(
|
|||||||
|
|
||||||
// This nested class implements the echo composed operation as a
|
// This nested class implements the echo composed operation as a
|
||||||
// stateful completion handler. We derive from `async_base` to
|
// stateful completion handler. We derive from `async_base` to
|
||||||
// take care of boilerplate and we derived from net::coroutine to
|
// take care of boilerplate and we derived from asio::coroutine to
|
||||||
// allow the reenter and yield keywords to work.
|
// allow the reenter and yield keywords to work.
|
||||||
|
|
||||||
struct echo_op : base_type, net::coroutine
|
struct echo_op : base_type, boost::asio::coroutine
|
||||||
{
|
{
|
||||||
AsyncStream& stream_;
|
AsyncStream& stream_;
|
||||||
DynamicBuffer& buffer_;
|
DynamicBuffer& buffer_;
|
||||||
|
@@ -238,7 +238,7 @@ fail(beast::error_code ec, char const* what)
|
|||||||
|
|
||||||
// Handles an HTTP server connection
|
// Handles an HTTP server connection
|
||||||
class session
|
class session
|
||||||
: public net::coroutine
|
: public boost::asio::coroutine
|
||||||
, public std::enable_shared_from_this<session>
|
, public std::enable_shared_from_this<session>
|
||||||
{
|
{
|
||||||
// This is the C++11 equivalent of a generic lambda.
|
// This is the C++11 equivalent of a generic lambda.
|
||||||
@@ -398,7 +398,7 @@ public:
|
|||||||
|
|
||||||
// Accepts incoming connections and launches the sessions
|
// Accepts incoming connections and launches the sessions
|
||||||
class listener
|
class listener
|
||||||
: public net::coroutine
|
: public boost::asio::coroutine
|
||||||
, public std::enable_shared_from_this<listener>
|
, public std::enable_shared_from_this<listener>
|
||||||
{
|
{
|
||||||
net::io_context& ioc_;
|
net::io_context& ioc_;
|
||||||
|
@@ -214,7 +214,7 @@ fail(beast::error_code ec, char const* what)
|
|||||||
|
|
||||||
// Handles an HTTP server connection
|
// Handles an HTTP server connection
|
||||||
class session
|
class session
|
||||||
: public net::coroutine
|
: public boost::asio::coroutine
|
||||||
, public std::enable_shared_from_this<session>
|
, public std::enable_shared_from_this<session>
|
||||||
{
|
{
|
||||||
// This is the C++11 equivalent of a generic lambda.
|
// This is the C++11 equivalent of a generic lambda.
|
||||||
@@ -344,7 +344,7 @@ public:
|
|||||||
|
|
||||||
// Accepts incoming connections and launches the sessions
|
// Accepts incoming connections and launches the sessions
|
||||||
class listener
|
class listener
|
||||||
: public net::coroutine
|
: public boost::asio::coroutine
|
||||||
, public std::enable_shared_from_this<listener>
|
, public std::enable_shared_from_this<listener>
|
||||||
{
|
{
|
||||||
net::io_context& ioc_;
|
net::io_context& ioc_;
|
||||||
@@ -407,7 +407,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
#include <boost/asio/yield.hpp>
|
#include <boost/asio/yield.hpp>
|
||||||
|
|
||||||
void
|
void
|
||||||
loop(beast::error_code ec = {})
|
loop(beast::error_code ec = {})
|
||||||
{
|
{
|
||||||
|
@@ -48,7 +48,7 @@ fail(beast::error_code ec, char const* what)
|
|||||||
|
|
||||||
// Echoes back all received WebSocket messages
|
// Echoes back all received WebSocket messages
|
||||||
class session
|
class session
|
||||||
: public net::coroutine
|
: public boost::asio::coroutine
|
||||||
, public std::enable_shared_from_this<session>
|
, public std::enable_shared_from_this<session>
|
||||||
{
|
{
|
||||||
websocket::stream<beast::ssl_stream<beast::tcp_stream>> ws_;
|
websocket::stream<beast::ssl_stream<beast::tcp_stream>> ws_;
|
||||||
@@ -164,7 +164,7 @@ public:
|
|||||||
|
|
||||||
// Accepts incoming connections and launches the sessions
|
// Accepts incoming connections and launches the sessions
|
||||||
class listener
|
class listener
|
||||||
: public net::coroutine
|
: public boost::asio::coroutine
|
||||||
, public std::enable_shared_from_this<listener>
|
, public std::enable_shared_from_this<listener>
|
||||||
{
|
{
|
||||||
net::io_context& ioc_;
|
net::io_context& ioc_;
|
||||||
|
@@ -43,7 +43,7 @@ fail(beast::error_code ec, char const* what)
|
|||||||
|
|
||||||
// Echoes back all received WebSocket messages
|
// Echoes back all received WebSocket messages
|
||||||
class session
|
class session
|
||||||
: public net::coroutine
|
: public boost::asio::coroutine
|
||||||
, public std::enable_shared_from_this<session>
|
, public std::enable_shared_from_this<session>
|
||||||
{
|
{
|
||||||
websocket::stream<beast::tcp_stream> ws_;
|
websocket::stream<beast::tcp_stream> ws_;
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include <boost/asio/yield.hpp>
|
#include <boost/asio/yield.hpp>
|
||||||
|
|
||||||
void
|
void
|
||||||
loop(
|
loop(
|
||||||
beast::error_code ec,
|
beast::error_code ec,
|
||||||
@@ -141,7 +141,7 @@ public:
|
|||||||
|
|
||||||
// Accepts incoming connections and launches the sessions
|
// Accepts incoming connections and launches the sessions
|
||||||
class listener
|
class listener
|
||||||
: public net::coroutine
|
: public boost::asio::coroutine
|
||||||
, public std::enable_shared_from_this<listener>
|
, public std::enable_shared_from_this<listener>
|
||||||
{
|
{
|
||||||
net::io_context& ioc_;
|
net::io_context& ioc_;
|
||||||
@@ -202,7 +202,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
#include <boost/asio/yield.hpp>
|
#include <boost/asio/yield.hpp>
|
||||||
|
|
||||||
void
|
void
|
||||||
loop(beast::error_code ec = {})
|
loop(beast::error_code ec = {})
|
||||||
{
|
{
|
||||||
|
@@ -35,7 +35,7 @@ is_icy(ConstBufferSequence const& buffers)
|
|||||||
char buf[3];
|
char buf[3];
|
||||||
auto const n = net::buffer_copy(
|
auto const n = net::buffer_copy(
|
||||||
net::mutable_buffer(buf, 3),
|
net::mutable_buffer(buf, 3),
|
||||||
buffers);
|
buffers);
|
||||||
if(n >= 1 && buf[0] != 'I')
|
if(n >= 1 && buf[0] != 'I')
|
||||||
return false;
|
return false;
|
||||||
if(n >= 2 && buf[1] != 'C')
|
if(n >= 2 && buf[1] != 'C')
|
||||||
@@ -57,7 +57,7 @@ template<class Buffers, class Handler>
|
|||||||
class read_op
|
class read_op
|
||||||
: public beast::async_base<Handler,
|
: public beast::async_base<Handler,
|
||||||
beast::executor_type<icy_stream>>
|
beast::executor_type<icy_stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
icy_stream& s_;
|
icy_stream& s_;
|
||||||
Buffers b_;
|
Buffers b_;
|
||||||
|
@@ -37,7 +37,7 @@ template<
|
|||||||
class Condition,
|
class Condition,
|
||||||
class Handler>
|
class Handler>
|
||||||
class read_op
|
class read_op
|
||||||
: public net::coroutine
|
: public asio::coroutine
|
||||||
, public async_base<
|
, public async_base<
|
||||||
Handler, beast::executor_type<Stream>>
|
Handler, beast::executor_type<Stream>>
|
||||||
{
|
{
|
||||||
|
@@ -164,7 +164,7 @@ template<
|
|||||||
class read_msg_op
|
class read_msg_op
|
||||||
: public beast::stable_async_base<
|
: public beast::stable_async_base<
|
||||||
Handler, beast::executor_type<Stream>>
|
Handler, beast::executor_type<Stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
using parser_type =
|
using parser_type =
|
||||||
parser<isRequest, Body, Allocator>;
|
parser<isRequest, Body, Allocator>;
|
||||||
|
@@ -159,7 +159,7 @@ template<
|
|||||||
class write_op
|
class write_op
|
||||||
: public beast::async_base<
|
: public beast::async_base<
|
||||||
Handler, beast::executor_type<Stream>>
|
Handler, beast::executor_type<Stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
Stream& s_;
|
Stream& s_;
|
||||||
serializer<isRequest, Body, Fields>& sr_;
|
serializer<isRequest, Body, Fields>& sr_;
|
||||||
|
@@ -167,7 +167,7 @@ template<class Handler>
|
|||||||
class stream<NextLayer, deflateSupported>::response_op
|
class stream<NextLayer, deflateSupported>::response_op
|
||||||
: public beast::stable_async_base<
|
: public beast::stable_async_base<
|
||||||
Handler, beast::executor_type<stream>>
|
Handler, beast::executor_type<stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
boost::weak_ptr<impl_type> wp_;
|
boost::weak_ptr<impl_type> wp_;
|
||||||
error_code result_; // must come before res_
|
error_code result_; // must come before res_
|
||||||
@@ -242,7 +242,7 @@ template<class Handler, class Decorator>
|
|||||||
class stream<NextLayer, deflateSupported>::accept_op
|
class stream<NextLayer, deflateSupported>::accept_op
|
||||||
: public beast::stable_async_base<
|
: public beast::stable_async_base<
|
||||||
Handler, beast::executor_type<stream>>
|
Handler, beast::executor_type<stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
boost::weak_ptr<impl_type> wp_;
|
boost::weak_ptr<impl_type> wp_;
|
||||||
http::request_parser<http::empty_body>& p_;
|
http::request_parser<http::empty_body>& p_;
|
||||||
|
@@ -38,7 +38,7 @@ template<class Handler>
|
|||||||
class stream<NextLayer, deflateSupported>::close_op
|
class stream<NextLayer, deflateSupported>::close_op
|
||||||
: public beast::stable_async_base<
|
: public beast::stable_async_base<
|
||||||
Handler, beast::executor_type<stream>>
|
Handler, beast::executor_type<stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
boost::weak_ptr<impl_type> wp_;
|
boost::weak_ptr<impl_type> wp_;
|
||||||
error_code ev_;
|
error_code ev_;
|
||||||
|
@@ -37,7 +37,7 @@ template<class Handler>
|
|||||||
class stream<NextLayer, deflateSupported>::handshake_op
|
class stream<NextLayer, deflateSupported>::handshake_op
|
||||||
: public beast::stable_async_base<Handler,
|
: public beast::stable_async_base<Handler,
|
||||||
beast::executor_type<stream>>
|
beast::executor_type<stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
struct data
|
struct data
|
||||||
{
|
{
|
||||||
|
@@ -35,7 +35,7 @@ template<class Handler>
|
|||||||
class stream<NextLayer, deflateSupported>::ping_op
|
class stream<NextLayer, deflateSupported>::ping_op
|
||||||
: public beast::stable_async_base<
|
: public beast::stable_async_base<
|
||||||
Handler, beast::executor_type<stream>>
|
Handler, beast::executor_type<stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
boost::weak_ptr<impl_type> wp_;
|
boost::weak_ptr<impl_type> wp_;
|
||||||
detail::frame_buffer& fb_;
|
detail::frame_buffer& fb_;
|
||||||
@@ -115,7 +115,7 @@ public:
|
|||||||
template<class NextLayer, bool deflateSupported>
|
template<class NextLayer, bool deflateSupported>
|
||||||
template<class Executor>
|
template<class Executor>
|
||||||
class stream<NextLayer, deflateSupported>::idle_ping_op
|
class stream<NextLayer, deflateSupported>::idle_ping_op
|
||||||
: public net::coroutine
|
: public asio::coroutine
|
||||||
, public boost::empty_value<Executor>
|
, public boost::empty_value<Executor>
|
||||||
{
|
{
|
||||||
boost::weak_ptr<impl_type> wp_;
|
boost::weak_ptr<impl_type> wp_;
|
||||||
|
@@ -48,7 +48,7 @@ template<class Handler, class MutableBufferSequence>
|
|||||||
class stream<NextLayer, deflateSupported>::read_some_op
|
class stream<NextLayer, deflateSupported>::read_some_op
|
||||||
: public beast::async_base<
|
: public beast::async_base<
|
||||||
Handler, beast::executor_type<stream>>
|
Handler, beast::executor_type<stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
boost::weak_ptr<impl_type> wp_;
|
boost::weak_ptr<impl_type> wp_;
|
||||||
MutableBufferSequence bs_;
|
MutableBufferSequence bs_;
|
||||||
@@ -619,7 +619,7 @@ template<class Handler, class DynamicBuffer>
|
|||||||
class stream<NextLayer, deflateSupported>::read_op
|
class stream<NextLayer, deflateSupported>::read_op
|
||||||
: public beast::async_base<
|
: public beast::async_base<
|
||||||
Handler, beast::executor_type<stream>>
|
Handler, beast::executor_type<stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
boost::weak_ptr<impl_type> wp_;
|
boost::weak_ptr<impl_type> wp_;
|
||||||
DynamicBuffer& b_;
|
DynamicBuffer& b_;
|
||||||
|
@@ -33,7 +33,7 @@ class teardown_tcp_op
|
|||||||
Handler, beast::executor_type<
|
Handler, beast::executor_type<
|
||||||
net::basic_stream_socket<
|
net::basic_stream_socket<
|
||||||
Protocol, Executor>>>
|
Protocol, Executor>>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
using socket_type =
|
using socket_type =
|
||||||
net::basic_stream_socket<Protocol, Executor>;
|
net::basic_stream_socket<Protocol, Executor>;
|
||||||
|
@@ -41,7 +41,7 @@ template<class Handler, class Buffers>
|
|||||||
class stream<NextLayer, deflateSupported>::write_some_op
|
class stream<NextLayer, deflateSupported>::write_some_op
|
||||||
: public beast::async_base<
|
: public beast::async_base<
|
||||||
Handler, beast::executor_type<stream>>
|
Handler, beast::executor_type<stream>>
|
||||||
, public net::coroutine
|
, public asio::coroutine
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user