Fixes to support Asio changes (API Change):

This adjusts Beast's interfaces and implementation to match
the changes in Boost.Asio.
This commit is contained in:
Vinnie Falco
2019-02-19 16:23:30 -08:00
parent ac24e58fb3
commit 6baa607295
58 changed files with 762 additions and 723 deletions
+17 -23
View File
@@ -303,7 +303,6 @@ private:
}
};
} // (anon)
class basic_stream_test
@@ -319,9 +318,6 @@ public:
void
testSpecialMembers()
{
using stream_type = tcp_stream<
net::io_context::executor_type>;
net::io_context ioc;
// net::io_context::executor_type
@@ -332,7 +328,8 @@ public:
basic_stream<tcp, executor> s2(ex);
basic_stream<tcp, executor> s3(ioc, tcp::v4());
basic_stream<tcp, executor> s4(std::move(s1));
s2.socket() = tcp::socket(ioc);
s2.socket() =
net::basic_stream_socket<tcp, executor>(ioc);
BEAST_EXPECT(s1.get_executor() == ex);
BEAST_EXPECT(s2.get_executor() == ex);
BEAST_EXPECT(s3.get_executor() == ex);
@@ -358,14 +355,19 @@ public:
basic_stream<tcp, strand> s1(ex);
basic_stream<tcp, strand> s2(ex, tcp::v4());
basic_stream<tcp, strand> s3(std::move(s1));
s2.socket() = tcp::socket(ioc);
#if 0
s2.socket() = net::basic_stream_socket<
tcp, strand>(ioc);
#endif
BEAST_EXPECT(s1.get_executor() == ex);
BEAST_EXPECT(s2.get_executor() == ex);
BEAST_EXPECT(s3.get_executor() == ex);
#if 0
BEAST_EXPECT((! static_cast<
basic_stream<tcp, strand> const&>(
s2).socket().is_open()));
#endif
test_sync_stream<
basic_stream<
@@ -378,6 +380,7 @@ public:
// construction from existing socket
#if 0
{
tcp::socket sock(ioc);
basic_stream<tcp, executor> stream(std::move(sock));
@@ -387,22 +390,13 @@ public:
tcp::socket sock(ioc);
basic_stream<tcp, strand> stream(std::move(sock));
}
struct other_type
{
};
BOOST_STATIC_ASSERT(! std::is_constructible<
stream_type, other_type>::value);
BOOST_STATIC_ASSERT(! std::is_constructible<
stream_type, other_type, tcp::socket>::value);
#endif
// layers
{
net::socket_base::keep_alive opt;
stream_type s(ioc);
tcp_stream s(ioc);
s.socket().open(tcp::v4());
s.socket().get_option(opt);
BEAST_EXPECT(! opt.value());
@@ -450,7 +444,7 @@ public:
void
testRead()
{
using stream_type = tcp_stream<
using stream_type = basic_stream<tcp,
net::io_context::executor_type>;
char buf[4];
@@ -585,7 +579,7 @@ public:
void
testWrite()
{
using stream_type = tcp_stream<
using stream_type = basic_stream<tcp,
net::io_context::executor_type>;
char buf[4];
@@ -667,7 +661,7 @@ public:
void
testConnect()
{
using stream_type = tcp_stream<
using stream_type = basic_stream<tcp,
net::io_context::executor_type>;
struct range
@@ -1057,7 +1051,7 @@ public:
void
testMembers()
{
using stream_type = tcp_stream<
using stream_type = basic_stream<tcp,
net::io_context::executor_type>;
class handler
@@ -1184,7 +1178,7 @@ public:
return {};
}
void process_http_1 (tcp_stream<net::io_context::executor_type>& stream, net::yield_context yield)
void process_http_1 (tcp_stream& stream, net::yield_context yield)
{
flat_buffer buffer;
http::request<http::empty_body> req;
@@ -1201,7 +1195,7 @@ public:
http::async_write (stream, res, yield);
}
void process_http_2 (tcp_stream<net::io_context::executor_type>& stream, net::yield_context yield)
void process_http_2 (tcp_stream& stream, net::yield_context yield)
{
flat_buffer buffer;
http::request<http::empty_body> req;