diff --git a/CHANGELOG.md b/CHANGELOG.md index 550dd054..772f4237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +Version 221: + +* Rename to async_base, stable_async_base + +-------------------------------------------------------------------------------- + +Version 220: + +* Documentation and release notes + +-------------------------------------------------------------------------------- + Version 219: * More split definitions in test::stream diff --git a/doc/qbk/03_core/7_composed.qbk b/doc/qbk/03_core/7_composed.qbk index f2fd3bfe..83e9aa12 100644 --- a/doc/qbk/03_core/7_composed.qbk +++ b/doc/qbk/03_core/7_composed.qbk @@ -44,8 +44,8 @@ composed operations: [table Asynchronous Helpers [[Name][Description]] [[ - [link beast.ref.boost__beast__async_op_base `async_op_base`] - [link beast.ref.boost__beast__stable_async_op_base `stable_async_op_base`] + [link beast.ref.boost__beast__async_base `async_op_base`] + [link beast.ref.boost__beast__stable_async_base `stable_async_base`] ][ This class is designed to be used as a base class when authoring composed asynchronous operations expressed as an intermediate diff --git a/doc/qbk/quickref.xml b/doc/qbk/quickref.xml index cd7e3fba..2d8e98fe 100644 --- a/doc/qbk/quickref.xml +++ b/doc/qbk/quickref.xml @@ -23,7 +23,7 @@ Classes (1 of 2) - async_op_base  + async_base  basic_stream  file file_mode @@ -47,7 +47,7 @@ span simple_rate_policy  static_string - stable_async_op_base  + stable_async_base  string_param string_view tcp_stream  diff --git a/doc/qbk/release_notes.qbk b/doc/qbk/release_notes.qbk index 4a7e5a4b..97c01264 100644 --- a/doc/qbk/release_notes.qbk +++ b/doc/qbk/release_notes.qbk @@ -11,6 +11,8 @@ [/-----------------------------------------------------------------------------] +[/ + * [phrase library..[@/libs/beast/ Beast]:] '''BIG Update!!!''' The [@/libs/beast/doc/html/beast/quickref.html reference] @@ -45,8 +47,8 @@ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1322r0.html P1322R0], no more `bind_executor` at call sites! * Base classes - [@/libs/beast/doc/html/beast/ref/boost__beast__async_op_base.html `async_op_base`] and - [@/libs/beast/doc/html/beast/ref/boost__beast__stable_async_op_base.html `stable_async_op_base`] and + [@/libs/beast/doc/html/beast/ref/boost__beast__async_base.html `async_base`] and + [@/libs/beast/doc/html/beast/ref/boost__beast__stable_async_base.html `stable_async_base`] and handle all composed operation boilerplate for you. * [@/libs/beast/doc/html/beast/ref/boost__beast__ssl_stream.html `ssl_stream`] provides a movable, assignable SSL stream with a flat write optimization. @@ -58,6 +60,8 @@ [@/libs/beast/doc/html/beast/release_notes.html Release Notes] for a complete list of changes. +] + [/-----------------------------------------------------------------------------] [heading Boost 1.70] @@ -144,8 +148,8 @@ * New trait `buffers_type` * New classes - `async_op_base`, - `stable_async_op_base` + `async_base`, + `stable_async_base` * Handle boilerplate for writing composed operations * New `allocate_stable` diff --git a/doc/source.dox b/doc/source.dox index 7f943c46..7e2dea35 100644 --- a/doc/source.dox +++ b/doc/source.dox @@ -104,7 +104,6 @@ WARN_LOGFILE = #--------------------------------------------------------------------------- INPUT = \ $(LIB_DIR)/include/boost/beast/ \ - $(LIB_DIR)/include/boost/beast/_experimental/core \ $(LIB_DIR)/include/boost/beast/_experimental/http \ $(LIB_DIR)/include/boost/beast/_experimental/test \ $(LIB_DIR)/include/boost/beast/core \ diff --git a/example/echo-op/echo_op.cpp b/example/echo-op/echo_op.cpp index db064ec5..bb1d0ff5 100644 --- a/example/echo-op/echo_op.cpp +++ b/example/echo-op/echo_op.cpp @@ -143,7 +143,7 @@ async_echo( using handler_type = BOOST_ASIO_HANDLER_TYPE(CompletionToken, void(beast::error_code)); - // The class template `async_op_base` holds the caller's completion + // The class template `async_base` holds the caller's completion // handler for us, and provides all of the boilerplate for forwarding // the associated allocator and associated executor from the caller's // handler to our operation. It also maintains a `net::executor_work_guard` @@ -154,13 +154,13 @@ async_echo( // performs more than one asynchronous operation in a row). // We declare this type alias to make the code easier to read. - using base_type = beast::async_op_base< + using base_type = beast::async_base< handler_type, /*< The type of the completion handler obtained from the token >*/ beast::executor_type /*< The type of executor used by the stream to dispatch asynchronous operations >*/ >; // This nested class implements the echo composed operation as a - // stateful completion handler. We derive from `async_op_base` to + // stateful completion handler. We derive from `async_base` to // take care of boilerplate and we derived from net::coroutine to // allow the reenter and yield keywords to work. @@ -174,7 +174,7 @@ async_echo( DynamicBuffer& buffer, handler_type&& handler) : base_type( - std::move(handler), /*< The `async_op_base` helper takes ownership of the handler, >*/ + std::move(handler), /*< The `async_base` helper takes ownership of the handler, >*/ stream.get_executor()) /*< and also needs to know which executor to use. >*/ , stream_(stream) , buffer_(buffer) @@ -304,7 +304,7 @@ async_echo( // if cont == false (meaning, that the call stack still includes // the frame of the initiating function) then we need to use // `net::post` to cause us to be called again after the initiating - // function. The function `async_op_base::invoke` takes care of + // function. The function `async_base::invoke` takes care of // calling the final completion handler, using post if the // first argument is false, otherwise invoking it directly. diff --git a/include/boost/beast/_experimental/http/icy_stream.hpp b/include/boost/beast/_experimental/http/icy_stream.hpp index 3746448f..2eb0c6e1 100644 --- a/include/boost/beast/_experimental/http/icy_stream.hpp +++ b/include/boost/beast/_experimental/http/icy_stream.hpp @@ -40,16 +40,11 @@ namespace http { @par Example - To use the @ref stream template with an `ip::tcp::socket`, + To use the @ref icy_stream template with an @ref tcp_stream you would write: @code - http::icy_stream is{io_context}; - @endcode - Alternatively, you can write: - @code - ip::tcp::socket sock{io_context}; - http::icy_stream is{sock}; + http::icy_stream is(ioc); @endcode @tparam NextLayer The type representing the next layer, to which diff --git a/include/boost/beast/_experimental/http/impl/icy_stream.hpp b/include/boost/beast/_experimental/http/impl/icy_stream.hpp index 30a65067..a35ad015 100644 --- a/include/boost/beast/_experimental/http/impl/icy_stream.hpp +++ b/include/boost/beast/_experimental/http/impl/icy_stream.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_BEAST_CORE_IMPL_ICY_STREAM_HPP #define BOOST_BEAST_CORE_IMPL_ICY_STREAM_HPP -#include +#include #include #include #include @@ -123,7 +123,7 @@ struct icy_stream::ops template class read_op - : public beast::stable_async_op_base> , public net::coroutine { @@ -159,7 +159,7 @@ public: Handler_&& h, icy_stream& s, Buffers const& b) - : stable_async_op_base>( std::forward(h), s.get_executor()) , d_(beast::allocate_stable(*this, s, b)) diff --git a/include/boost/beast/core/async_op_base.hpp b/include/boost/beast/core/async_base.hpp similarity index 92% rename from include/boost/beast/core/async_op_base.hpp rename to include/boost/beast/core/async_base.hpp index 33008d03..5124abe7 100644 --- a/include/boost/beast/core/async_op_base.hpp +++ b/include/boost/beast/core/async_base.hpp @@ -7,13 +7,13 @@ // Official repository: https://github.com/boostorg/beast // -#ifndef BOOST_BEAST_CORE_ASYNC_OP_BASE_HPP -#define BOOST_BEAST_CORE_ASYNC_OP_BASE_HPP +#ifndef BOOST_BEAST_CORE_ASYNC_BASE_HPP +#define BOOST_BEAST_CORE_ASYNC_BASE_HPP #include #include #include -#include +#include #include #include #include @@ -40,7 +40,7 @@ namespace beast { The composed operation must be typical; that is, associated with one executor of an I/O object, and invoking a caller-provided completion handler when the operation is finished. Classes derived from - @ref async_op_base will acquire these properties: + @ref async_base will acquire these properties: @li Ownership of the final completion handler provided upon construction. @@ -69,7 +69,7 @@ namespace beast { @par Example - The following code demonstrates how @ref async_op_base may be be used to + The following code demonstrates how @ref async_base may be be used to assist authoring an asynchronous initiating function, by providing all of the boilerplate to manage the final completion handler in a way that maintains the allocator and executor associations: @@ -82,7 +82,7 @@ namespace beast { async_read(AsyncReadStream& stream, net::mutable_buffer buffer, ReadHandler&& handler) { using handler_type = BOOST_ASIO_HANDLER_TYPE(ReadHandler, void(error_code, std::size_t)); - using base_type = async_op_base; + using base_type = async_base; struct op : base_type { @@ -132,7 +132,7 @@ namespace beast { do not have stable addresses, as the composed operation object is move constructed upon each call to an initiating function. For most operations this is not a problem. For complex operations requiring stable temporary - storage, the class @ref stable_async_op_base is provided which offers + storage, the class @ref stable_async_base is provided which offers additional functionality: @li The free function @ref allocate_stable may be used to allocate @@ -169,14 +169,14 @@ namespace beast { not default constructible, an instance of the type must be provided upon construction. - @see @ref stable_async_op_base + @see @ref stable_async_base */ template< class Handler, class Executor1, class Allocator = std::allocator > -class async_op_base +class async_base #if ! BOOST_BEAST_DOXYGEN : private boost::empty_value #endif @@ -212,7 +212,7 @@ public: */ #if BOOST_BEAST_DOXYGEN template - async_op_base( + async_base( Handler&& handler, Executor1 const& ex1, Allocator const& alloc = Allocator()); @@ -222,10 +222,10 @@ public: class = typename std::enable_if< ! std::is_same::type, - async_op_base + async_base >::value>::type > - async_op_base( + async_base( Handler_&& handler, Executor1 const& ex1) : h_(std::forward(handler)) @@ -234,7 +234,7 @@ public: } template - async_op_base( + async_base( Handler_&& handler, Executor1 const& ex1, Allocator const& alloc) @@ -247,11 +247,11 @@ public: #endif /// Move Constructor - async_op_base(async_op_base&& other) = default; + async_base(async_base&& other) = default; /** The type of allocator associated with this object. - If a class derived from @ref async_op_base is a completion + If a class derived from @ref async_base is a completion handler, then the associated allocator of the derived class will be this type. */ @@ -260,7 +260,7 @@ public: /** The type of executor associated with this object. - If a class derived from @ref async_op_base is a completion + If a class derived from @ref async_base is a completion handler, then the associated executor of the derived class will be this type. */ @@ -269,7 +269,7 @@ public: /** Returns the allocator associated with this object. - If a class derived from @ref async_op_base is a completion + If a class derived from @ref async_base is a completion handler, then the object returned from this function will be used as the associated allocator of the derived class. */ @@ -282,7 +282,7 @@ public: /** Returns the executor associated with this object. - If a class derived from @ref async_op_base is a completion + If a class derived from @ref async_base is a completion handler, then the object returned from this function will be used as the associated executor of the derived class. */ @@ -319,7 +319,7 @@ public: arguments forwarded. It is undefined to call either of @ref invoke or @ref invoke_now more than once. - Any temporary objects allocated with @ref allocate_stable will + Any temporary objects allocated with @ref beast::allocate_stable will be automatically destroyed before the final completion handler is invoked. @@ -359,7 +359,7 @@ public: arguments forwarded. It is undefined to call either of @ref invoke or @ref invoke_now more than once. - Any temporary objects allocated with @ref allocate_stable will + Any temporary objects allocated with @ref beast::allocate_stable will be automatically destroyed before the final completion handler is invoked. @@ -385,12 +385,12 @@ public: friend void asio_handler_invoke( Function&& f, - async_op_base< + async_base< Handler_, Executor1_, Allocator_>* p); friend void* asio_handler_allocate( - std::size_t size, async_op_base* p) + std::size_t size, async_base* p) { using net::asio_handler_allocate; return asio_handler_allocate( @@ -400,7 +400,7 @@ public: friend void asio_handler_deallocate( void* mem, std::size_t size, - async_op_base* p) + async_base* p) { using net::asio_handler_deallocate; asio_handler_deallocate(mem, size, @@ -409,7 +409,7 @@ public: friend bool asio_handler_is_continuation( - async_op_base* p) + async_base* p) { using net::asio_handler_is_continuation; return asio_handler_is_continuation( @@ -431,7 +431,7 @@ public: The composed operation must be typical; that is, associated with one executor of an I/O object, and invoking a caller-provided completion handler when the operation is finished. Classes derived from - @ref async_op_base will acquire these properties: + @ref async_base will acquire these properties: @li Ownership of the final completion handler provided upon construction. @@ -462,7 +462,7 @@ public: do not have stable addresses, as the composed operation object is move constructed upon each call to an initiating function. For most operations this is not a problem. For complex operations requiring stable temporary - storage, the class @ref stable_async_op_base is provided which offers + storage, the class @ref stable_async_base is provided which offers additional functionality: @li The free function @ref allocate_stable may be used to allocate @@ -478,7 +478,7 @@ public: @par Example - The following code demonstrates how @ref stable_async_op_base may be be used to + The following code demonstrates how @ref stable_async_base may be be used to assist authoring an asynchronous initiating function, by providing all of the boilerplate to manage the final completion handler in a way that maintains the allocator and executor associations. Furthermore, the operation shown @@ -499,7 +499,7 @@ public: void(error_code)>::return_type { using handler_type = typename net::async_completion::completion_handler_type; - using base_type = stable_async_op_base; + using base_type = stable_async_base; struct op : base_type { @@ -592,15 +592,15 @@ public: not default constructible, an instance of the type must be provided upon construction. - @see @ref allocate_stable, @ref async_op_base + @see @ref allocate_stable, @ref async_base */ template< class Handler, class Executor1, class Allocator = std::allocator > -class stable_async_op_base - : public async_op_base< +class stable_async_base + : public async_base< Handler, Executor1, Allocator> { detail::stable_base* list_ = nullptr; @@ -629,7 +629,7 @@ public: */ #if BOOST_BEAST_DOXYGEN template - stable_async_op_base( + stable_async_base( Handler&& handler, Executor1 const& ex1, Allocator const& alloc = Allocator()); @@ -639,24 +639,24 @@ public: class = typename std::enable_if< ! std::is_same::type, - stable_async_op_base + stable_async_base >::value>::type > - stable_async_op_base( + stable_async_base( Handler_&& handler, Executor1 const& ex1) - : async_op_base< + : async_base< Handler, Executor1, Allocator>( std::forward(handler), ex1) { } template - stable_async_op_base( + stable_async_base( Handler_&& handler, Executor1 const& ex1, Allocator const& alloc) - : async_op_base< + : async_base< Handler, Executor1, Allocator>( std::forward(handler), ex1, alloc) { @@ -664,8 +664,8 @@ public: #endif /// Move Constructor - stable_async_op_base(stable_async_op_base&& other) - : async_op_base( + stable_async_base(stable_async_base&& other) + : async_base( std::move(other)) , list_(boost::exchange(other.list_, nullptr)) { @@ -677,7 +677,7 @@ public: state objects allocated with @ref allocate_stable will be destroyed here. */ - ~stable_async_op_base() + ~stable_async_base() { detail::stable_base::destroy_list(list_); } @@ -696,7 +696,7 @@ public: friend State& allocate_stable( - stable_async_op_base< + stable_async_base< Handler_, Executor1_, Allocator_>& base, Args&&... args); }; @@ -709,7 +709,7 @@ template< class Function> void asio_handler_invoke( Function&& f, - async_op_base< + async_base< Handler, Executor1, Allocator>* p) { using net::asio_handler_invoke; @@ -757,7 +757,7 @@ struct allocate_stable_state final The object will be destroyed just before the completion handler is invoked, or when the base is destroyed. - @see @ref stable_async_op_base + @see @ref stable_async_base */ template< class State, @@ -767,11 +767,11 @@ template< class... Args> State& allocate_stable( - stable_async_op_base< + stable_async_base< Handler, Executor1, Allocator>& base, Args&&... args) { - using allocator_type = typename stable_async_op_base< + using allocator_type = typename stable_async_base< Handler, Executor1, Allocator>::allocator_type; using A = typename detail::allocator_traits< diff --git a/include/boost/beast/core/detail/async_op_base.hpp b/include/boost/beast/core/detail/async_base.hpp similarity index 88% rename from include/boost/beast/core/detail/async_op_base.hpp rename to include/boost/beast/core/detail/async_base.hpp index badc547c..0224daf7 100644 --- a/include/boost/beast/core/detail/async_op_base.hpp +++ b/include/boost/beast/core/detail/async_base.hpp @@ -7,8 +7,8 @@ // Official repository: https://github.com/boostorg/beast // -#ifndef BOOST_BEAST_CORE_DETAIL_ASYNC_OP_BASE_HPP -#define BOOST_BEAST_CORE_DETAIL_ASYNC_OP_BASE_HPP +#ifndef BOOST_BEAST_CORE_DETAIL_ASYNC_BASE_HPP +#define BOOST_BEAST_CORE_DETAIL_ASYNC_BASE_HPP #include diff --git a/include/boost/beast/core/detail/impl/read.hpp b/include/boost/beast/core/detail/impl/read.hpp index 7a4d7b14..7d50a8e6 100644 --- a/include/boost/beast/core/detail/impl/read.hpp +++ b/include/boost/beast/core/detail/impl/read.hpp @@ -11,7 +11,7 @@ #define BOOST_BEAST_DETAIL_IMPL_READ_HPP #include -#include +#include #include #include #include @@ -38,7 +38,7 @@ template< class Handler> class read_op : public net::coroutine - , public async_op_base< + , public async_base< Handler, beast::executor_type> { Stream& s_; @@ -56,7 +56,7 @@ public: Stream& s, DynamicBuffer& b, Condition_&& cond) - : async_op_base>( std::forward(h), s.get_executor()) diff --git a/include/boost/beast/core/detect_ssl.hpp b/include/boost/beast/core/detect_ssl.hpp index 47621080..b4ca2511 100644 --- a/include/boost/beast/core/detect_ssl.hpp +++ b/include/boost/beast/core/detect_ssl.hpp @@ -11,7 +11,7 @@ #define BOOST_BEAST_CORE_DETECT_SSL_HPP #include -#include +#include #include #include #include @@ -447,7 +447,7 @@ namespace detail { // which are based on macros forming a switch statement. The // operation is derived from `coroutine` for this reason. // -// The library type `async_op_base` takes care of all of the +// The library type `async_base` takes care of all of the // boilerplate for writing composed operations, including: // // * Storing the user's completion handler @@ -457,7 +457,7 @@ namespace detail { // * Deallocating temporary storage before invoking the handler // * Posting the handler to the executor on an immediate completion // -// `async_op_base` needs to know the type of the handler, as well +// `async_base` needs to know the type of the handler, as well // as the executor of the I/O object being used. The metafunction // `executor_type` returns the type of executor used by an // I/O object. @@ -468,7 +468,7 @@ template< class DynamicBuffer> class detect_ssl_op : public boost::asio::coroutine - , public async_op_base< + , public async_base< DetectHandler, executor_type> { // This composed operation has trivial state, @@ -495,7 +495,7 @@ public: DetectHandler_&& handler, AsyncReadStream& stream, DynamicBuffer& buffer) - : beast::async_op_base< + : beast::async_base< DetectHandler_, beast::executor_type>( std::forward(handler), diff --git a/include/boost/beast/core/impl/basic_stream.hpp b/include/boost/beast/core/impl/basic_stream.hpp index 16956771..7db2e1e4 100644 --- a/include/boost/beast/core/impl/basic_stream.hpp +++ b/include/boost/beast/core/impl/basic_stream.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_BEAST_CORE_IMPL_BASIC_STREAM_HPP #define BOOST_BEAST_CORE_IMPL_BASIC_STREAM_HPP -#include +#include #include #include #include @@ -202,7 +202,7 @@ struct basic_stream::ops template class transfer_op - : public async_op_base + : public async_base , public boost::asio::coroutine { boost::shared_ptr impl_; @@ -294,7 +294,7 @@ public: Handler_&& h, basic_stream& s, Buffers const& b) - : async_op_base( + : async_base( std::forward(h), s.get_executor()) , impl_(s.impl_) , pg_(state().pending) @@ -404,7 +404,7 @@ public: template class connect_op - : public async_op_base + : public async_base { boost::shared_ptr impl_; pending_guard pg0_; @@ -422,7 +422,7 @@ public: Handler_&& h, basic_stream& s, endpoint_type ep) - : async_op_base( + : async_base( std::forward(h), s.get_executor()) , impl_(s.impl_) , pg0_(impl_->read.pending) @@ -450,7 +450,7 @@ public: basic_stream& s, Endpoints const& eps, Condition const& cond) - : async_op_base( + : async_base( std::forward(h), s.get_executor()) , impl_(s.impl_) , pg0_(impl_->read.pending) @@ -478,7 +478,7 @@ public: basic_stream& s, Iterator begin, Iterator end, Condition const& cond) - : async_op_base( + : async_base( std::forward(h), s.get_executor()) , impl_(s.impl_) , pg0_(impl_->read.pending) diff --git a/include/boost/beast/core/impl/buffered_read_stream.hpp b/include/boost/beast/core/impl/buffered_read_stream.hpp index f36a40a4..0513c52d 100644 --- a/include/boost/beast/core/impl/buffered_read_stream.hpp +++ b/include/boost/beast/core/impl/buffered_read_stream.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_BEAST_IMPL_BUFFERED_READ_STREAM_HPP #define BOOST_BEAST_IMPL_BUFFERED_READ_STREAM_HPP -#include +#include #include #include #include @@ -29,7 +29,7 @@ struct buffered_read_stream::ops template class read_op - : public async_op_base> { buffered_read_stream& s_; @@ -45,7 +45,7 @@ public: Handler_&& h, buffered_read_stream& s, MutableBufferSequence const& b) - : async_op_base< + : async_base< Handler, beast::executor_type>( std::forward(h), s.get_executor()) , s_(s) diff --git a/include/boost/beast/core/impl/flat_stream.hpp b/include/boost/beast/core/impl/flat_stream.hpp index 304ef00e..c29e89dd 100644 --- a/include/boost/beast/core/impl/flat_stream.hpp +++ b/include/boost/beast/core/impl/flat_stream.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_BEAST_CORE_IMPL_FLAT_STREAM_HPP #define BOOST_BEAST_CORE_IMPL_FLAT_STREAM_HPP -#include +#include #include #include #include @@ -28,7 +28,7 @@ struct flat_stream::ops template class write_op - : public async_op_base> , public net::coroutine { @@ -40,7 +40,7 @@ public: Handler_&& h, flat_stream& s, ConstBufferSequence const& b) - : async_op_base>( std::forward(h), s.get_executor()) diff --git a/include/boost/beast/http/impl/file_body_win32.hpp b/include/boost/beast/http/impl/file_body_win32.hpp index 6bb797bb..35db52bf 100644 --- a/include/boost/beast/http/impl/file_body_win32.hpp +++ b/include/boost/beast/http/impl/file_body_win32.hpp @@ -12,7 +12,7 @@ #if BOOST_BEAST_USE_WIN32_FILE -#include +#include #include #include #include @@ -331,7 +331,7 @@ template< bool isRequest, class Fields, class Handler> class write_some_win32_op - : public beast::async_op_base + : public beast::async_base { net::basic_stream_socket< Protocol, Executor>& sock_; @@ -348,7 +348,7 @@ public: Protocol, Executor>& s, serializer,Fields>& sr) - : async_op_base< + : async_base< Handler, Executor>( std::forward(h), s.get_executor()) diff --git a/include/boost/beast/http/impl/read.hpp b/include/boost/beast/http/impl/read.hpp index fd2f02be..6d69da3f 100644 --- a/include/boost/beast/http/impl/read.hpp +++ b/include/boost/beast/http/impl/read.hpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -158,7 +158,7 @@ template< bool isRequest, class Body, class Allocator, class Handler> class read_msg_op - : public beast::stable_async_op_base< + : public beast::stable_async_base< Handler, beast::executor_type> , public net::coroutine { @@ -193,7 +193,7 @@ public: Stream& s, DynamicBuffer& b, message_type& m) - : stable_async_op_base< + : stable_async_base< Handler, beast::executor_type>( std::forward(h), s.get_executor()) , d_(beast::allocate_stable( diff --git a/include/boost/beast/http/impl/write.hpp b/include/boost/beast/http/impl/write.hpp index 42154d53..e0bdba33 100644 --- a/include/boost/beast/http/impl/write.hpp +++ b/include/boost/beast/http/impl/write.hpp @@ -11,7 +11,7 @@ #define BOOST_BEAST_HTTP_IMPL_WRITE_HPP #include -#include +#include #include #include #include @@ -34,7 +34,7 @@ template< class Stream, bool isRequest, class Body, class Fields> class write_some_op - : public beast::async_op_base< + : public beast::async_base< Handler, beast::executor_type> { Stream& s_; @@ -72,7 +72,7 @@ public: Handler_&& h, Stream& s, serializer& sr) - : async_op_base< + : async_base< Handler, beast::executor_type>( std::forward(h), s.get_executor()) , s_(s) @@ -157,7 +157,7 @@ template< class Predicate, bool isRequest, class Body, class Fields> class write_op - : public beast::async_op_base< + : public beast::async_base< Handler, beast::executor_type> , public net::coroutine { @@ -171,7 +171,7 @@ public: Handler_&& h, Stream& s, serializer& sr) - : async_op_base< + : async_base< Handler, beast::executor_type>( std::forward(h), s.get_executor()) , s_(s) @@ -219,7 +219,7 @@ template< class Stream, bool isRequest, class Body, class Fields> class write_msg_op - : public beast::stable_async_op_base< + : public beast::stable_async_base< Handler, beast::executor_type> { Stream& s_; @@ -233,7 +233,7 @@ public: Handler_&& h, Stream& s, Args&&... args) - : stable_async_op_base< + : stable_async_base< Handler, beast::executor_type>( std::forward(h), s.get_executor()) , s_(s) diff --git a/include/boost/beast/websocket/impl/accept.hpp b/include/boost/beast/websocket/impl/accept.hpp index 74e13289..ca2e631e 100644 --- a/include/boost/beast/websocket/impl/accept.hpp +++ b/include/boost/beast/websocket/impl/accept.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -170,7 +170,7 @@ build_response( template template class stream::response_op - : public beast::stable_async_op_base< + : public beast::stable_async_base< Handler, beast::executor_type> , public net::coroutine { @@ -190,7 +190,7 @@ public: http::basic_fields> const& req, Decorator const& decorator, bool cont = false) - : stable_async_op_base>( std::forward(h), sp->stream.get_executor()) @@ -243,7 +243,7 @@ public: template template class stream::accept_op - : public beast::stable_async_op_base< + : public beast::stable_async_base< Handler, beast::executor_type> , public net::coroutine { @@ -258,7 +258,7 @@ public: boost::shared_ptr const& sp, Decorator const& decorator, Buffers const& buffers) - : stable_async_op_base>( std::forward(h), sp->stream.get_executor()) diff --git a/include/boost/beast/websocket/impl/close.hpp b/include/boost/beast/websocket/impl/close.hpp index e4801489..d707c83c 100644 --- a/include/boost/beast/websocket/impl/close.hpp +++ b/include/boost/beast/websocket/impl/close.hpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -36,7 +36,7 @@ namespace websocket { template template class stream::close_op - : public beast::stable_async_op_base< + : public beast::stable_async_base< Handler, beast::executor_type> , public net::coroutine { @@ -52,7 +52,7 @@ public: Handler_&& h, boost::shared_ptr const& sp, close_reason const& cr) - : stable_async_op_base>( std::forward(h), sp->stream.get_executor()) diff --git a/include/boost/beast/websocket/impl/handshake.hpp b/include/boost/beast/websocket/impl/handshake.hpp index 47dfb546..2d9d8b91 100644 --- a/include/boost/beast/websocket/impl/handshake.hpp +++ b/include/boost/beast/websocket/impl/handshake.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include @@ -35,7 +35,7 @@ namespace websocket { template template class stream::handshake_op - : public beast::stable_async_op_base> , public net::coroutine { @@ -65,7 +65,7 @@ public: response_type* res_p, string_view host, string_view target, Decorator const& decorator) - : stable_async_op_base>( std::forward(h), sp->stream.get_executor()) diff --git a/include/boost/beast/websocket/impl/ping.hpp b/include/boost/beast/websocket/impl/ping.hpp index a6b363f0..a2f4f2dd 100644 --- a/include/boost/beast/websocket/impl/ping.hpp +++ b/include/boost/beast/websocket/impl/ping.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_BEAST_WEBSOCKET_IMPL_PING_HPP #define BOOST_BEAST_WEBSOCKET_IMPL_PING_HPP -#include +#include #include #include #include @@ -33,7 +33,7 @@ namespace websocket { template template class stream::ping_op - : public beast::stable_async_op_base< + : public beast::stable_async_base< Handler, beast::executor_type> , public net::coroutine { @@ -49,7 +49,7 @@ public: boost::shared_ptr const& sp, detail::opcode op, ping_data const& payload) - : stable_async_op_base>( std::forward(h), sp->stream.get_executor()) diff --git a/include/boost/beast/websocket/impl/read.hpp b/include/boost/beast/websocket/impl/read.hpp index 79fa28e1..fe11d81c 100644 --- a/include/boost/beast/websocket/impl/read.hpp +++ b/include/boost/beast/websocket/impl/read.hpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ namespace websocket { template template class stream::read_some_op - : public beast::async_op_base< + : public beast::async_base< Handler, beast::executor_type> , public net::coroutine { @@ -65,7 +65,7 @@ public: Handler_&& h, boost::shared_ptr const& sp, MutableBufferSequence const& bs) - : async_op_base< + : async_base< Handler, beast::executor_type>( std::forward(h), sp->stream.get_executor()) @@ -613,7 +613,7 @@ public: template template class stream::read_op - : public beast::async_op_base< + : public beast::async_base< Handler, beast::executor_type> , public net::coroutine { @@ -631,7 +631,7 @@ public: DynamicBuffer& b, std::size_t limit, bool some) - : async_op_base>( std::forward(h), sp->stream.get_executor()) diff --git a/include/boost/beast/websocket/impl/teardown.hpp b/include/boost/beast/websocket/impl/teardown.hpp index 8d25a849..8aa088bc 100644 --- a/include/boost/beast/websocket/impl/teardown.hpp +++ b/include/boost/beast/websocket/impl/teardown.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_BEAST_WEBSOCKET_IMPL_TEARDOWN_HPP #define BOOST_BEAST_WEBSOCKET_IMPL_TEARDOWN_HPP -#include +#include #include #include #include @@ -29,7 +29,7 @@ template< class Protocol, class Executor, class Handler> class teardown_tcp_op - : public beast::async_op_base< + : public beast::async_base< Handler, beast::executor_type< net::basic_stream_socket< Protocol, Executor>>> @@ -48,7 +48,7 @@ public: Handler_&& h, socket_type& s, role_type role) - : async_op_base>>( diff --git a/include/boost/beast/websocket/impl/write.hpp b/include/boost/beast/websocket/impl/write.hpp index 7d424fc1..53df10d6 100644 --- a/include/boost/beast/websocket/impl/write.hpp +++ b/include/boost/beast/websocket/impl/write.hpp @@ -11,7 +11,7 @@ #define BOOST_BEAST_WEBSOCKET_IMPL_WRITE_HPP #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ namespace websocket { template template class stream::write_some_op - : public beast::async_op_base< + : public beast::async_base< Handler, beast::executor_type> , public net::coroutine { @@ -73,7 +73,7 @@ public: boost::shared_ptr const& sp, bool fin, Buffers const& bs) - : beast::async_op_base>( std::forward(h), sp->stream.get_executor()) diff --git a/test/beast/_experimental/Jamfile b/test/beast/_experimental/Jamfile index ff7d2e4d..aa4f0eb0 100644 --- a/test/beast/_experimental/Jamfile +++ b/test/beast/_experimental/Jamfile @@ -10,7 +10,6 @@ local SOURCES = error.cpp icy_stream.cpp - ssl_stream.cpp stream.cpp ; diff --git a/test/beast/_experimental/ssl_stream.cpp b/test/beast/_experimental/ssl_stream.cpp deleted file mode 100644 index 6ac4745c..00000000 --- a/test/beast/_experimental/ssl_stream.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail 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) -// -// Official repository: https://github.com/boostorg/beast -// - -#if BOOST_BEAST_USE_OPENSSL - -// Test that header file is self-contained. -#include - -#endif diff --git a/test/beast/core/CMakeLists.txt b/test/beast/core/CMakeLists.txt index 3606549d..bef22643 100644 --- a/test/beast/core/CMakeLists.txt +++ b/test/beast/core/CMakeLists.txt @@ -31,7 +31,7 @@ add_executable (tests-beast-core _detail_tuple.cpp _detail_variant.cpp _detail_varint.cpp - async_op_base.cpp + async_base.cpp basic_stream.cpp bind_handler.cpp buffer_size.cpp diff --git a/test/beast/core/Jamfile b/test/beast/core/Jamfile index 0bd70b00..693d88a5 100644 --- a/test/beast/core/Jamfile +++ b/test/beast/core/Jamfile @@ -19,7 +19,7 @@ local SOURCES = _detail_tuple.cpp _detail_variant.cpp _detail_varint.cpp - async_op_base.cpp + async_base.cpp basic_stream.cpp bind_handler.cpp buffer_size.cpp diff --git a/test/beast/core/async_op_base.cpp b/test/beast/core/async_base.cpp similarity index 92% rename from test/beast/core/async_op_base.cpp rename to test/beast/core/async_base.cpp index d1f1b4d9..bfd7ba61 100644 --- a/test/beast/core/async_op_base.cpp +++ b/test/beast/core/async_base.cpp @@ -8,7 +8,7 @@ // // Test that header file is self-contained. -#include +#include #include "test_handler.hpp" @@ -164,7 +164,7 @@ struct associated_executor< namespace boost { namespace beast { -class async_op_base_test : public beast::unit_test::suite +class async_base_test : public beast::unit_test::suite { public: // no associated allocator @@ -173,7 +173,7 @@ public: std::is_same< std::allocator, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type> >>::value); @@ -182,7 +182,7 @@ public: std::is_same< std::allocator, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type, std::allocator> @@ -192,7 +192,7 @@ public: std::is_same< std::allocator, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type>, std::allocator // ignored @@ -202,7 +202,7 @@ public: std::is_same< std::allocator, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type, std::allocator>, @@ -215,7 +215,7 @@ public: std::is_same< nested_alloc::allocator_type, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type> >>::value); @@ -224,7 +224,7 @@ public: std::is_same< nested_alloc::allocator_type, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type, std::allocator> // ignored @@ -234,7 +234,7 @@ public: std::is_same< nested_alloc::allocator_type, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type>, std::allocator // ignored @@ -244,7 +244,7 @@ public: std::is_same< nested_alloc::allocator_type, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type, std::allocator>, // ignored @@ -257,7 +257,7 @@ public: std::is_same< intrusive_alloc::allocator_type, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type> >>::value); @@ -266,7 +266,7 @@ public: std::is_same< intrusive_alloc::allocator_type, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type, std::allocator> // ignored @@ -276,7 +276,7 @@ public: std::is_same< intrusive_alloc::allocator_type, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type>, std::allocator // ignored @@ -286,7 +286,7 @@ public: std::is_same< intrusive_alloc::allocator_type, net::associated_allocator_t< - async_op_base< + async_base< handler, net::io_context::executor_type, std::allocator>, // ignored @@ -299,7 +299,7 @@ public: std::is_same< ex1_type, net::associated_executor_t< - async_op_base< + async_base< handler, ex1_type> >>::value); @@ -308,7 +308,7 @@ public: std::is_same< ex1_type, net::associated_executor_t< - async_op_base< + async_base< handler, ex1_type>, net::system_executor // ignored @@ -320,7 +320,7 @@ public: std::is_same< nested_ex::executor_type, net::associated_executor_t< - async_op_base< + async_base< handler, ex1_type> >>::value); @@ -329,7 +329,7 @@ public: std::is_same< nested_ex::executor_type, net::associated_executor_t< - async_op_base< + async_base< handler, ex1_type>, net::system_executor // ignored @@ -341,7 +341,7 @@ public: std::is_same< intrusive_ex::executor_type, net::associated_executor_t< - async_op_base< + async_base< handler, ex1_type> >>::value); @@ -350,7 +350,7 @@ public: std::is_same< intrusive_ex::executor_type, net::associated_executor_t< - async_op_base< + async_base< handler, ex1_type>, net::system_executor // ignored @@ -374,7 +374,7 @@ public: { simple_allocator alloc; simple_allocator alloc2; - async_op_base< + async_base< move_only_handler, simple_executor, simple_allocator> op( @@ -387,7 +387,7 @@ public: { simple_executor ex; simple_executor ex2; - async_op_base< + async_base< move_only_handler, simple_executor> op( move_only_handler{}, ex); @@ -397,7 +397,7 @@ public: // move construction { - async_op_base< + async_base< move_only_handler, simple_executor> op( move_only_handler{}, {}); @@ -407,7 +407,7 @@ public: // observers { bool b = false; - async_op_base< + async_base< legacy_handler, simple_executor> op( legacy_handler{b}, {}); @@ -421,7 +421,7 @@ public: // invocation { net::io_context ioc; - async_op_base< + async_base< test::handler, net::io_context::executor_type> op( test::any_handler(), ioc.get_executor()); @@ -429,7 +429,7 @@ public: } { net::io_context ioc; - async_op_base< + async_base< test::handler, net::io_context::executor_type> op( test::any_handler(), ioc.get_executor()); @@ -437,7 +437,7 @@ public: ioc.run(); } { - async_op_base< + async_base< test::handler, simple_executor> op( test::any_handler(), {}); @@ -448,7 +448,7 @@ public: legacy_handler::test( [](legacy_handler h) { - return async_op_base< + return async_base< legacy_handler, simple_executor>( std::move(h), {}); @@ -462,7 +462,7 @@ public: { simple_allocator alloc; simple_allocator alloc2; - stable_async_op_base< + stable_async_base< move_only_handler, simple_executor, simple_allocator> op( @@ -475,7 +475,7 @@ public: { simple_executor ex; simple_executor ex2; - stable_async_op_base< + stable_async_base< move_only_handler, simple_executor> op( move_only_handler{}, ex); @@ -485,7 +485,7 @@ public: // move construction { - stable_async_op_base< + stable_async_base< move_only_handler, simple_executor> op( move_only_handler{}, {}); @@ -495,7 +495,7 @@ public: // invocation { net::io_context ioc; - stable_async_op_base< + stable_async_base< test::handler, net::io_context::executor_type> op( test::any_handler(), ioc.get_executor()); @@ -503,7 +503,7 @@ public: } { net::io_context ioc; - stable_async_op_base< + stable_async_base< test::handler, net::io_context::executor_type> op( test::any_handler(), ioc.get_executor()); @@ -511,7 +511,7 @@ public: ioc.run(); } { - stable_async_op_base< + stable_async_base< test::handler, simple_executor> op( test::any_handler(), {}); @@ -522,7 +522,7 @@ public: legacy_handler::test( [](legacy_handler h) { - return stable_async_op_base< + return stable_async_base< legacy_handler, simple_executor>( std::move(h), {}); @@ -542,7 +542,7 @@ public: destroyed = true; } }; - stable_async_op_base< + stable_async_base< move_only_handler, simple_executor> op( move_only_handler{}, {}); @@ -561,7 +561,7 @@ public: std::exception{}); } }; - stable_async_op_base< + stable_async_base< move_only_handler, simple_executor> op( move_only_handler{}, {}); @@ -585,7 +585,7 @@ public: async_read(AsyncReadStream& stream, net::mutable_buffer buffer, ReadHandler&& handler) { using handler_type = BOOST_ASIO_HANDLER_TYPE(ReadHandler, void(error_code, std::size_t)); - using base_type = async_op_base; + using base_type = async_base; struct op : base_type { @@ -641,7 +641,7 @@ public: void(error_code)>::return_type { using handler_type = typename net::async_completion::completion_handler_type; - using base_type = stable_async_op_base; + using base_type = stable_async_base; struct op : base_type { @@ -728,8 +728,8 @@ public: } }; - BEAST_EXPECT((&async_op_base_test::async_read)); - BEAST_EXPECT((&async_op_base_test::async_write_messages)); + BEAST_EXPECT((&async_base_test::async_read)); + BEAST_EXPECT((&async_base_test::async_write_messages)); } //-------------------------------------------------------------------------- @@ -743,7 +743,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(beast,core,async_op_base); +BEAST_DEFINE_TESTSUITE(beast,core,async_base); } // beast } // boost diff --git a/test/doc/core_3_timeouts.cpp b/test/doc/core_3_timeouts.cpp index eecd7a2c..3995fc9c 100644 --- a/test/doc/core_3_timeouts.cpp +++ b/test/doc/core_3_timeouts.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include diff --git a/test/doc/core_4_layers.cpp b/test/doc/core_4_layers.cpp index 5492cd3c..dc7018d0 100644 --- a/test/doc/core_4_layers.cpp +++ b/test/doc/core_4_layers.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -86,8 +86,8 @@ class counted_stream { using handler_type = typename std::decay::type; - // async_op_base handles all of the composed operation boilerplate for us - using base = async_op_base< + // async_base handles all of the composed operation boilerplate for us + using base = async_base< handler_type, beast::executor_type>; // Our composed operation is implemented as a completion handler object @@ -132,8 +132,8 @@ class counted_stream { using handler_type = typename std::decay::type; - // async_op_base handles all of the composed operation boilerplate for us - using base = async_op_base< + // async_base handles all of the composed operation boilerplate for us + using base = async_base< handler_type, beast::executor_type>; // Our composed operation is implemented as a completion handler object diff --git a/test/doc/websocket_3_handshake.cpp b/test/doc/websocket_3_handshake.cpp index c9c587fe..24fef815 100644 --- a/test/doc/websocket_3_handshake.cpp +++ b/test/doc/websocket_3_handshake.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include