async_base.hpp 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/beast
  8. //
  9. #ifndef BOOST_BEAST_CORE_ASYNC_BASE_HPP
  10. #define BOOST_BEAST_CORE_ASYNC_BASE_HPP
  11. #include <boost/beast/core/detail/config.hpp>
  12. #include <boost/beast/core/bind_handler.hpp>
  13. #include <boost/beast/core/detail/allocator.hpp>
  14. #include <boost/beast/core/detail/async_base.hpp>
  15. #include <boost/asio/associated_allocator.hpp>
  16. #include <boost/asio/associated_executor.hpp>
  17. #include <boost/asio/bind_executor.hpp>
  18. #include <boost/asio/executor_work_guard.hpp>
  19. #include <boost/asio/handler_alloc_hook.hpp>
  20. #include <boost/asio/handler_continuation_hook.hpp>
  21. #include <boost/asio/handler_invoke_hook.hpp>
  22. #include <boost/asio/post.hpp>
  23. #include <boost/core/exchange.hpp>
  24. #include <boost/core/empty_value.hpp>
  25. #include <utility>
  26. namespace boost {
  27. namespace beast {
  28. /** Base class to assist writing composed operations.
  29. A function object submitted to intermediate initiating functions during
  30. a composed operation may derive from this type to inherit all of the
  31. boilerplate to forward the executor, allocator, and legacy customization
  32. points associated with the completion handler invoked at the end of the
  33. composed operation.
  34. The composed operation must be typical; that is, associated with one
  35. executor of an I/O object, and invoking a caller-provided completion
  36. handler when the operation is finished. Classes derived from
  37. @ref async_base will acquire these properties:
  38. @li Ownership of the final completion handler provided upon construction.
  39. @li If the final handler has an associated allocator, this allocator will
  40. be propagated to the composed operation subclass. Otherwise, the
  41. associated allocator will be the type specified in the allocator
  42. template parameter, or the default of `std::allocator<void>` if the
  43. parameter is omitted.
  44. @li If the final handler has an associated executor, then it will be used
  45. as the executor associated with the composed operation. Otherwise,
  46. the specified `Executor1` will be the type of executor associated
  47. with the composed operation.
  48. @li An instance of `net::executor_work_guard` for the instance of `Executor1`
  49. shall be maintained until either the final handler is invoked, or the
  50. operation base is destroyed, whichever comes first.
  51. @li Calls to the legacy customization points
  52. `asio_handler_invoke`,
  53. `asio_handler_allocate`,
  54. `asio_handler_deallocate`, and
  55. `asio_handler_is_continuation`,
  56. which use argument-dependent lookup, will be forwarded to the
  57. legacy customization points associated with the handler.
  58. @par Example
  59. The following code demonstrates how @ref async_base may be be used to
  60. assist authoring an asynchronous initiating function, by providing all of
  61. the boilerplate to manage the final completion handler in a way that
  62. maintains the allocator and executor associations:
  63. @code
  64. // Asynchronously read into a buffer until the buffer is full, or an error occurs
  65. template<class AsyncReadStream, class ReadHandler>
  66. typename net::async_result<ReadHandler, void(error_code, std::size_t)>::return_type
  67. async_read(AsyncReadStream& stream, net::mutable_buffer buffer, ReadHandler&& handler)
  68. {
  69. using handler_type = BOOST_ASIO_HANDLER_TYPE(ReadHandler, void(error_code, std::size_t));
  70. using base_type = async_base<handler_type, typename AsyncReadStream::executor_type>;
  71. struct op : base_type
  72. {
  73. AsyncReadStream& stream_;
  74. net::mutable_buffer buffer_;
  75. std::size_t total_bytes_transferred_;
  76. op(
  77. AsyncReadStream& stream,
  78. net::mutable_buffer buffer,
  79. handler_type& handler)
  80. : base_type(std::move(handler), stream.get_executor())
  81. , stream_(stream)
  82. , buffer_(buffer)
  83. , total_bytes_transferred_(0)
  84. {
  85. (*this)({}, 0, false); // start the operation
  86. }
  87. void operator()(error_code ec, std::size_t bytes_transferred, bool is_continuation = true)
  88. {
  89. // Adjust the count of bytes and advance our buffer
  90. total_bytes_transferred_ += bytes_transferred;
  91. buffer_ = buffer_ + bytes_transferred;
  92. // Keep reading until buffer is full or an error occurs
  93. if(! ec && buffer_.size() > 0)
  94. return stream_.async_read_some(buffer_, std::move(*this));
  95. // Call the completion handler with the result. If `is_continuation` is
  96. // false, which happens on the first time through this function, then
  97. // `net::post` will be used to call the completion handler, otherwise
  98. // the completion handler will be invoked directly.
  99. this->complete(is_continuation, ec, total_bytes_transferred_);
  100. }
  101. };
  102. net::async_completion<ReadHandler, void(error_code, std::size_t)> init{handler};
  103. op(stream, buffer, init.completion_handler);
  104. return init.result.get();
  105. }
  106. @endcode
  107. Data members of composed operations implemented as completion handlers
  108. do not have stable addresses, as the composed operation object is move
  109. constructed upon each call to an initiating function. For most operations
  110. this is not a problem. For complex operations requiring stable temporary
  111. storage, the class @ref stable_async_base is provided which offers
  112. additional functionality:
  113. @li The free function @ref allocate_stable may be used to allocate
  114. one or more temporary objects associated with the composed operation.
  115. @li Memory for stable temporary objects is allocated using the allocator
  116. associated with the composed operation.
  117. @li Stable temporary objects are automatically destroyed, and the memory
  118. freed using the associated allocator, either before the final completion
  119. handler is invoked (a Networking requirement) or when the composed operation
  120. is destroyed, whichever occurs first.
  121. @par Temporary Storage Example
  122. The following example demonstrates how a composed operation may store a
  123. temporary object.
  124. @code
  125. @endcode
  126. @tparam Handler The type of the completion handler to store.
  127. This type must meet the requirements of <em>CompletionHandler</em>.
  128. @tparam Executor1 The type of the executor used when the handler has no
  129. associated executor. An instance of this type must be provided upon
  130. construction. The implementation will maintain an executor work guard
  131. and a copy of this instance.
  132. @tparam Allocator The allocator type to use if the handler does not
  133. have an associated allocator. If this parameter is omitted, then
  134. `std::allocator<void>` will be used. If the specified allocator is
  135. not default constructible, an instance of the type must be provided
  136. upon construction.
  137. @see stable_async_base
  138. */
  139. template<
  140. class Handler,
  141. class Executor1,
  142. class Allocator = std::allocator<void>
  143. >
  144. class async_base
  145. #if ! BOOST_BEAST_DOXYGEN
  146. : private boost::empty_value<Allocator>
  147. #endif
  148. {
  149. static_assert(
  150. net::is_executor<Executor1>::value,
  151. "Executor type requirements not met");
  152. Handler h_;
  153. net::executor_work_guard<Executor1> wg1_;
  154. virtual
  155. void
  156. before_invoke_hook()
  157. {
  158. }
  159. public:
  160. /** Constructor
  161. @param handler The final completion handler.
  162. The type of this object must meet the requirements of <em>CompletionHandler</em>.
  163. The implementation takes ownership of the handler by performing a decay-copy.
  164. @param ex1 The executor associated with the implied I/O object
  165. target of the operation. The implementation shall maintain an
  166. executor work guard for the lifetime of the operation, or until
  167. the final completion handler is invoked, whichever is shorter.
  168. @param alloc The allocator to be associated with objects
  169. derived from this class. If `Allocator` is default-constructible,
  170. this parameter is optional and may be omitted.
  171. */
  172. #if BOOST_BEAST_DOXYGEN
  173. template<class Handler_>
  174. async_base(
  175. Handler&& handler,
  176. Executor1 const& ex1,
  177. Allocator const& alloc = Allocator());
  178. #else
  179. template<
  180. class Handler_,
  181. class = typename std::enable_if<
  182. ! std::is_same<typename
  183. std::decay<Handler_>::type,
  184. async_base
  185. >::value>::type
  186. >
  187. async_base(
  188. Handler_&& handler,
  189. Executor1 const& ex1)
  190. : h_(std::forward<Handler_>(handler))
  191. , wg1_(ex1)
  192. {
  193. }
  194. template<class Handler_>
  195. async_base(
  196. Handler_&& handler,
  197. Executor1 const& ex1,
  198. Allocator const& alloc)
  199. : boost::empty_value<Allocator>(
  200. boost::empty_init_t{}, alloc)
  201. , h_(std::forward<Handler_>(handler))
  202. , wg1_(ex1)
  203. {
  204. }
  205. #endif
  206. /// Move Constructor
  207. async_base(async_base&& other) = default;
  208. virtual ~async_base() = default;
  209. async_base(async_base const&) = delete;
  210. async_base& operator=(async_base const&) = delete;
  211. /** The type of allocator associated with this object.
  212. If a class derived from @ref async_base is a completion
  213. handler, then the associated allocator of the derived class will
  214. be this type.
  215. */
  216. using allocator_type =
  217. net::associated_allocator_t<Handler, Allocator>;
  218. /** The type of executor associated with this object.
  219. If a class derived from @ref async_base is a completion
  220. handler, then the associated executor of the derived class will
  221. be this type.
  222. */
  223. using executor_type =
  224. net::associated_executor_t<Handler, Executor1>;
  225. /** Returns the allocator associated with this object.
  226. If a class derived from @ref async_base is a completion
  227. handler, then the object returned from this function will be used
  228. as the associated allocator of the derived class.
  229. */
  230. allocator_type
  231. get_allocator() const noexcept
  232. {
  233. return net::get_associated_allocator(h_,
  234. boost::empty_value<Allocator>::get());
  235. }
  236. /** Returns the executor associated with this object.
  237. If a class derived from @ref async_base is a completion
  238. handler, then the object returned from this function will be used
  239. as the associated executor of the derived class.
  240. */
  241. executor_type
  242. get_executor() const noexcept
  243. {
  244. return net::get_associated_executor(
  245. h_, wg1_.get_executor());
  246. }
  247. /// Returns the handler associated with this object
  248. Handler const&
  249. handler() const noexcept
  250. {
  251. return h_;
  252. }
  253. /** Returns ownership of the handler associated with this object
  254. This function is used to transfer ownership of the handler to
  255. the caller, by move-construction. After the move, the only
  256. valid operations on the base object are move construction and
  257. destruction.
  258. */
  259. Handler
  260. release_handler()
  261. {
  262. return std::move(h_);
  263. }
  264. /** Invoke the final completion handler, maybe using post.
  265. This invokes the final completion handler with the specified
  266. arguments forwarded. It is undefined to call either of
  267. @ref complete or @ref complete_now more than once.
  268. Any temporary objects allocated with @ref beast::allocate_stable will
  269. be automatically destroyed before the final completion handler
  270. is invoked.
  271. @param is_continuation If this value is `false`, then the
  272. handler will be submitted to the executor using `net::post`.
  273. Otherwise the handler will be invoked as if by calling
  274. @ref complete_now.
  275. @param args A list of optional parameters to invoke the handler
  276. with. The completion handler must be invocable with the parameter
  277. list, or else a compilation error will result.
  278. */
  279. template<class... Args>
  280. void
  281. complete(bool is_continuation, Args&&... args)
  282. {
  283. this->before_invoke_hook();
  284. if(! is_continuation)
  285. {
  286. auto const ex = get_executor();
  287. net::post(net::bind_executor(
  288. ex,
  289. beast::bind_front_handler(
  290. std::move(h_),
  291. std::forward<Args>(args)...)));
  292. wg1_.reset();
  293. }
  294. else
  295. {
  296. wg1_.reset();
  297. h_(std::forward<Args>(args)...);
  298. }
  299. }
  300. /** Invoke the final completion handler.
  301. This invokes the final completion handler with the specified
  302. arguments forwarded. It is undefined to call either of
  303. @ref complete or @ref complete_now more than once.
  304. Any temporary objects allocated with @ref beast::allocate_stable will
  305. be automatically destroyed before the final completion handler
  306. is invoked.
  307. @param args A list of optional parameters to invoke the handler
  308. with. The completion handler must be invocable with the parameter
  309. list, or else a compilation error will result.
  310. */
  311. template<class... Args>
  312. void
  313. complete_now(Args&&... args)
  314. {
  315. this->before_invoke_hook();
  316. wg1_.reset();
  317. h_(std::forward<Args>(args)...);
  318. }
  319. #if ! BOOST_BEAST_DOXYGEN
  320. Handler*
  321. get_legacy_handler_pointer() noexcept
  322. {
  323. return std::addressof(h_);
  324. }
  325. #endif
  326. };
  327. //------------------------------------------------------------------------------
  328. /** Base class to provide completion handler boilerplate for composed operations.
  329. A function object submitted to intermediate initiating functions during
  330. a composed operation may derive from this type to inherit all of the
  331. boilerplate to forward the executor, allocator, and legacy customization
  332. points associated with the completion handler invoked at the end of the
  333. composed operation.
  334. The composed operation must be typical; that is, associated with one
  335. executor of an I/O object, and invoking a caller-provided completion
  336. handler when the operation is finished. Classes derived from
  337. @ref async_base will acquire these properties:
  338. @li Ownership of the final completion handler provided upon construction.
  339. @li If the final handler has an associated allocator, this allocator will
  340. be propagated to the composed operation subclass. Otherwise, the
  341. associated allocator will be the type specified in the allocator
  342. template parameter, or the default of `std::allocator<void>` if the
  343. parameter is omitted.
  344. @li If the final handler has an associated executor, then it will be used
  345. as the executor associated with the composed operation. Otherwise,
  346. the specified `Executor1` will be the type of executor associated
  347. with the composed operation.
  348. @li An instance of `net::executor_work_guard` for the instance of `Executor1`
  349. shall be maintained until either the final handler is invoked, or the
  350. operation base is destroyed, whichever comes first.
  351. @li Calls to the legacy customization points
  352. `asio_handler_invoke`,
  353. `asio_handler_allocate`,
  354. `asio_handler_deallocate`, and
  355. `asio_handler_is_continuation`,
  356. which use argument-dependent lookup, will be forwarded to the
  357. legacy customization points associated with the handler.
  358. Data members of composed operations implemented as completion handlers
  359. do not have stable addresses, as the composed operation object is move
  360. constructed upon each call to an initiating function. For most operations
  361. this is not a problem. For complex operations requiring stable temporary
  362. storage, the class @ref stable_async_base is provided which offers
  363. additional functionality:
  364. @li The free function @ref beast::allocate_stable may be used to allocate
  365. one or more temporary objects associated with the composed operation.
  366. @li Memory for stable temporary objects is allocated using the allocator
  367. associated with the composed operation.
  368. @li Stable temporary objects are automatically destroyed, and the memory
  369. freed using the associated allocator, either before the final completion
  370. handler is invoked (a Networking requirement) or when the composed operation
  371. is destroyed, whichever occurs first.
  372. @par Example
  373. The following code demonstrates how @ref stable_async_base may be be used to
  374. assist authoring an asynchronous initiating function, by providing all of
  375. the boilerplate to manage the final completion handler in a way that maintains
  376. the allocator and executor associations. Furthermore, the operation shown
  377. allocates temporary memory using @ref beast::allocate_stable for the timer and
  378. message, whose addresses must not change between intermediate operations:
  379. @code
  380. // Asynchronously send a message multiple times, once per second
  381. template <class AsyncWriteStream, class T, class WriteHandler>
  382. auto async_write_messages(
  383. AsyncWriteStream& stream,
  384. T const& message,
  385. std::size_t repeat_count,
  386. WriteHandler&& handler) ->
  387. typename net::async_result<
  388. typename std::decay<WriteHandler>::type,
  389. void(error_code)>::return_type
  390. {
  391. using handler_type = typename net::async_completion<WriteHandler, void(error_code)>::completion_handler_type;
  392. using base_type = stable_async_base<handler_type, typename AsyncWriteStream::executor_type>;
  393. struct op : base_type, boost::asio::coroutine
  394. {
  395. // This object must have a stable address
  396. struct temporary_data
  397. {
  398. // Although std::string is in theory movable, most implementations
  399. // use a "small buffer optimization" which means that we might
  400. // be submitting a buffer to the write operation and then
  401. // moving the string, invalidating the buffer. To prevent
  402. // undefined behavior we store the string object itself at
  403. // a stable location.
  404. std::string const message;
  405. net::steady_timer timer;
  406. temporary_data(std::string message_, net::io_context& ctx)
  407. : message(std::move(message_))
  408. , timer(ctx)
  409. {
  410. }
  411. };
  412. AsyncWriteStream& stream_;
  413. std::size_t repeats_;
  414. temporary_data& data_;
  415. op(AsyncWriteStream& stream, std::size_t repeats, std::string message, handler_type& handler)
  416. : base_type(std::move(handler), stream.get_executor())
  417. , stream_(stream)
  418. , repeats_(repeats)
  419. , data_(allocate_stable<temporary_data>(*this, std::move(message), stream.get_executor().context()))
  420. {
  421. (*this)(); // start the operation
  422. }
  423. // Including this file provides the keywords for macro-based coroutines
  424. #include <boost/asio/yield.hpp>
  425. void operator()(error_code ec = {}, std::size_t = 0)
  426. {
  427. reenter(*this)
  428. {
  429. // If repeats starts at 0 then we must complete immediately. But
  430. // we can't call the final handler from inside the initiating
  431. // function, so we post our intermediate handler first. We use
  432. // net::async_write with an empty buffer instead of calling
  433. // net::post to avoid an extra function template instantiation, to
  434. // keep compile times lower and make the resulting executable smaller.
  435. yield net::async_write(stream_, net::const_buffer{}, std::move(*this));
  436. while(! ec && repeats_-- > 0)
  437. {
  438. // Send the string. We construct a `const_buffer` here to guarantee
  439. // that we do not create an additional function template instantation
  440. // of net::async_write, since we already instantiated it above for
  441. // net::const_buffer.
  442. yield net::async_write(stream_,
  443. net::const_buffer(net::buffer(data_.message)), std::move(*this));
  444. if(ec)
  445. break;
  446. // Set the timer and wait
  447. data_.timer.expires_after(std::chrono::seconds(1));
  448. yield data_.timer.async_wait(std::move(*this));
  449. }
  450. }
  451. // The base class destroys the temporary data automatically,
  452. // before invoking the final completion handler
  453. this->complete_now(ec);
  454. }
  455. // Including this file undefines the macros for the coroutines
  456. #include <boost/asio/unyield.hpp>
  457. };
  458. net::async_completion<WriteHandler, void(error_code)> completion(handler);
  459. std::ostringstream os;
  460. os << message;
  461. op(stream, repeat_count, os.str(), completion.completion_handler);
  462. return completion.result.get();
  463. }
  464. @endcode
  465. @tparam Handler The type of the completion handler to store.
  466. This type must meet the requirements of <em>CompletionHandler</em>.
  467. @tparam Executor1 The type of the executor used when the handler has no
  468. associated executor. An instance of this type must be provided upon
  469. construction. The implementation will maintain an executor work guard
  470. and a copy of this instance.
  471. @tparam Allocator The allocator type to use if the handler does not
  472. have an associated allocator. If this parameter is omitted, then
  473. `std::allocator<void>` will be used. If the specified allocator is
  474. not default constructible, an instance of the type must be provided
  475. upon construction.
  476. @see allocate_stable, async_base
  477. */
  478. template<
  479. class Handler,
  480. class Executor1,
  481. class Allocator = std::allocator<void>
  482. >
  483. class stable_async_base
  484. : public async_base<
  485. Handler, Executor1, Allocator>
  486. {
  487. detail::stable_base* list_ = nullptr;
  488. void
  489. before_invoke_hook() override
  490. {
  491. detail::stable_base::destroy_list(list_);
  492. }
  493. public:
  494. /** Constructor
  495. @param handler The final completion handler.
  496. The type of this object must meet the requirements of <em>CompletionHandler</em>.
  497. The implementation takes ownership of the handler by performing a decay-copy.
  498. @param ex1 The executor associated with the implied I/O object
  499. target of the operation. The implementation shall maintain an
  500. executor work guard for the lifetime of the operation, or until
  501. the final completion handler is invoked, whichever is shorter.
  502. @param alloc The allocator to be associated with objects
  503. derived from this class. If `Allocator` is default-constructible,
  504. this parameter is optional and may be omitted.
  505. */
  506. #if BOOST_BEAST_DOXYGEN
  507. template<class Handler>
  508. stable_async_base(
  509. Handler&& handler,
  510. Executor1 const& ex1,
  511. Allocator const& alloc = Allocator());
  512. #else
  513. template<
  514. class Handler_,
  515. class = typename std::enable_if<
  516. ! std::is_same<typename
  517. std::decay<Handler_>::type,
  518. stable_async_base
  519. >::value>::type
  520. >
  521. stable_async_base(
  522. Handler_&& handler,
  523. Executor1 const& ex1)
  524. : async_base<
  525. Handler, Executor1, Allocator>(
  526. std::forward<Handler_>(handler), ex1)
  527. {
  528. }
  529. template<class Handler_>
  530. stable_async_base(
  531. Handler_&& handler,
  532. Executor1 const& ex1,
  533. Allocator const& alloc)
  534. : async_base<
  535. Handler, Executor1, Allocator>(
  536. std::forward<Handler_>(handler), ex1, alloc)
  537. {
  538. }
  539. #endif
  540. /// Move Constructor
  541. stable_async_base(stable_async_base&& other)
  542. : async_base<Handler, Executor1, Allocator>(
  543. std::move(other))
  544. , list_(boost::exchange(other.list_, nullptr))
  545. {
  546. }
  547. /** Destructor
  548. If the completion handler was not invoked, then any
  549. state objects allocated with @ref allocate_stable will
  550. be destroyed here.
  551. */
  552. ~stable_async_base()
  553. {
  554. detail::stable_base::destroy_list(list_);
  555. }
  556. /** Allocate a temporary object to hold operation state.
  557. The object will be destroyed just before the completion
  558. handler is invoked, or when the operation base is destroyed.
  559. */
  560. template<
  561. class State,
  562. class Handler_,
  563. class Executor1_,
  564. class Allocator_,
  565. class... Args>
  566. friend
  567. State&
  568. allocate_stable(
  569. stable_async_base<
  570. Handler_, Executor1_, Allocator_>& base,
  571. Args&&... args);
  572. };
  573. /** Allocate a temporary object to hold stable asynchronous operation state.
  574. The object will be destroyed just before the completion
  575. handler is invoked, or when the base is destroyed.
  576. @tparam State The type of object to allocate.
  577. @param base The helper to allocate from.
  578. @param args An optional list of parameters to forward to the
  579. constructor of the object being allocated.
  580. @see stable_async_base
  581. */
  582. template<
  583. class State,
  584. class Handler,
  585. class Executor1,
  586. class Allocator,
  587. class... Args>
  588. State&
  589. allocate_stable(
  590. stable_async_base<
  591. Handler, Executor1, Allocator>& base,
  592. Args&&... args);
  593. } // beast
  594. } // boost
  595. #include <boost/beast/core/impl/async_base.hpp>
  596. #endif