Fix all async initiating functions with use_awaitable:

Add trait:
    is_completion_token_for

Fixes for
    buffered_read_stream

Add tests for
    basic_stream
    buffered_read_stream
    flat_stream
    http (all)
    websocket (all)

resolves #1920
This commit is contained in:
Richard Hodges
2020-04-28 20:48:00 +02:00
parent 24cc4a7aee
commit d016ff52af
14 changed files with 382 additions and 6 deletions
+22
View File
@@ -18,6 +18,10 @@
#include <boost/asio/io_context.hpp>
#include <boost/asio/strand.hpp>
#if BOOST_ASIO_HAS_CO_AWAIT
#include <boost/asio/use_awaitable.hpp>
#endif
namespace boost {
namespace beast {
namespace websocket {
@@ -483,12 +487,30 @@ public:
}
};
#if BOOST_ASIO_HAS_CO_AWAIT
void testAwaitableCompiles(
stream<test::stream>& s,
ping_data& pdat)
{
static_assert(std::is_same_v<
net::awaitable<void>, decltype(
s.async_ping(pdat, net::use_awaitable))>);
static_assert(std::is_same_v<
net::awaitable<void>, decltype(
s.async_pong(pdat, net::use_awaitable))>);
}
#endif
void
run() override
{
testPing();
testSuspend();
testMoveOnly();
#if BOOST_ASIO_HAS_CO_AWAIT
boost::ignore_unused(&ping_test::testAwaitableCompiles);
#endif
}
};