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
+23
View File
@@ -13,6 +13,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
#include "test.hpp"
namespace boost {
@@ -716,6 +720,22 @@ public:
BEAST_EXPECT(n1 < n0 + s.size());
}
#if BOOST_ASIO_HAS_CO_AWAIT
void testAwaitableCompiles(
stream<test::stream>& s,
net::mutable_buffer buf,
bool fin)
{
static_assert(std::is_same_v<
net::awaitable<std::size_t>, decltype(
s.async_write(buf, net::use_awaitable))>);
static_assert(std::is_same_v<
net::awaitable<std::size_t>, decltype(
s.async_write_some(fin, buf, net::use_awaitable))>);
}
#endif
void
run() override
{
@@ -726,6 +746,9 @@ public:
testMoveOnly();
testIssue300();
testIssue1666();
#if BOOST_ASIO_HAS_CO_AWAIT
boost::ignore_unused(&write_test::testAwaitableCompiles);
#endif
}
};