Add executor rebind to test::stream

closes #2139
This commit is contained in:
Richard Hodges
2020-12-16 21:11:29 +01:00
parent a87330e53f
commit 8913a3cd21
13 changed files with 619 additions and 400 deletions
+19
View File
@@ -14,7 +14,11 @@
#include <boost/beast/_experimental/test/handler.hpp>
#include <boost/asio/ssl/stream.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/asio/use_awaitable.hpp>
#endif
#define DEF boost::asio::use_future_t
namespace boost {
namespace beast {
@@ -153,6 +157,18 @@ public:
test::stream>::value);
}
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
net::awaitable<void>
testRebind(net::mutable_buffer& b)
{
auto ex = co_await net::this_coro::executor;
auto s1 = test::stream(ex);
auto s2 = net::use_awaitable.as_default_on(std::move(s1));
auto bt = co_await s2.async_read_some(b);
bt = co_await s2.async_write_some(b);
}
#endif
void
run() override
{
@@ -160,6 +176,9 @@ public:
testSharedAbandon();
//testLifetimeViolation();
boost::ignore_unused(&stream_test::testAsioSSLCompat);
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
boost::ignore_unused(&stream_test::testRebind);
#endif
}
};