net is a namespace alias for boost::asio:

The namespace alias beast::net replaces boost::asio in all code
and documentation.
This commit is contained in:
Vinnie Falco committed 2018-12-02 17:51:43 -08:00
1 parent a5739c3ea0
commit f995fd41a3
185 files changed
+2486 -2392

No files matched your search

+32 -32
View File
@@ -40,12 +40,12 @@ namespace websocket {
template<class NextLayer, bool deflateSupported>
template<class Handler>
class stream<NextLayer, deflateSupported>::response_op
: public boost::asio::coroutine
: public net::coroutine
{
struct data
{
stream<NextLayer, deflateSupported>& ws;
boost::asio::executor_work_guard<decltype(std::declval<
net::executor_work_guard<decltype(std::declval<
stream<NextLayer, deflateSupported>&>().get_executor())> wg;
error_code result;
response_type res;
@@ -79,22 +79,22 @@ public:
}
using allocator_type =
boost::asio::associated_allocator_t<Handler>;
net::associated_allocator_t<Handler>;
allocator_type
get_allocator() const noexcept
{
return (boost::asio::get_associated_allocator)(d_.handler());
return (net::get_associated_allocator)(d_.handler());
}
using executor_type = boost::asio::associated_executor_t<
using executor_type = net::associated_executor_t<
Handler, decltype(std::declval<
stream<NextLayer, deflateSupported>&>().get_executor())>;
executor_type
get_executor() const noexcept
{
return (boost::asio::get_associated_executor)(
return (net::get_associated_executor)(
d_.handler(), d_->ws.get_executor());
}
@@ -105,7 +105,7 @@ public:
friend
bool asio_handler_is_continuation(response_op* op)
{
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
return asio_handler_is_continuation(
std::addressof(op->d_.handler()));
}
@@ -114,7 +114,7 @@ public:
friend
void asio_handler_invoke(Function&& f, response_op* op)
{
using boost::asio::asio_handler_invoke;
using net::asio_handler_invoke;
asio_handler_invoke(f, std::addressof(op->d_.handler()));
}
};
@@ -156,12 +156,12 @@ operator()(
template<class NextLayer, bool deflateSupported>
template<class Decorator, class Handler>
class stream<NextLayer, deflateSupported>::accept_op
: public boost::asio::coroutine
: public net::coroutine
{
struct data
{
stream<NextLayer, deflateSupported>& ws;
boost::asio::executor_work_guard<decltype(std::declval<
net::executor_work_guard<decltype(std::declval<
stream<NextLayer, deflateSupported>&>().get_executor())> wg;
Decorator decorator;
http::request_parser<http::empty_body> p;
@@ -191,21 +191,21 @@ public:
}
using allocator_type =
boost::asio::associated_allocator_t<Handler>;
net::associated_allocator_t<Handler>;
allocator_type
get_allocator() const noexcept
{
return (boost::asio::get_associated_allocator)(d_.handler());
return (net::get_associated_allocator)(d_.handler());
}
using executor_type = boost::asio::associated_executor_t<
using executor_type = net::associated_executor_t<
Handler, decltype(std::declval<stream<NextLayer, deflateSupported>&>().get_executor())>;
executor_type
get_executor() const noexcept
{
return (boost::asio::get_associated_executor)(
return (net::get_associated_executor)(
d_.handler(), d_->ws.get_executor());
}
@@ -219,7 +219,7 @@ public:
friend
bool asio_handler_is_continuation(accept_op* op)
{
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
return asio_handler_is_continuation(
std::addressof(op->d_.handler()));
}
@@ -228,7 +228,7 @@ public:
friend
void asio_handler_invoke(Function&& f, accept_op* op)
{
using boost::asio::asio_handler_invoke;
using net::asio_handler_invoke;
asio_handler_invoke(f, std::addressof(op->d_.handler()));
}
};
@@ -241,8 +241,8 @@ stream<NextLayer, deflateSupported>::
accept_op<Decorator, Handler>::
run(Buffers const& buffers)
{
using boost::asio::buffer_copy;
using boost::asio::buffer_size;
using net::buffer_copy;
using net::buffer_size;
auto& d = *d_;
error_code ec;
auto const mb = beast::detail::dynamic_buffer_prepare(
@@ -267,7 +267,7 @@ operator()(error_code ec, std::size_t)
if(ec)
{
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
d.ws.get_executor(),
beast::bind_front_handler(std::move(*this), ec));
}
@@ -375,7 +375,7 @@ accept(ConstBufferSequence const& buffers)
{
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
error_code ec;
@@ -397,7 +397,7 @@ accept_ex(
{
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
static_assert(detail::is_response_decorator<
@@ -419,11 +419,11 @@ accept(
{
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
using boost::asio::buffer_copy;
using boost::asio::buffer_size;
using net::buffer_copy;
using net::buffer_size;
reset();
auto const mb = beast::detail::dynamic_buffer_prepare(
rd_buf_, buffer_size(buffers), ec,
@@ -448,14 +448,14 @@ accept_ex(
{
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
using boost::asio::buffer_copy;
using boost::asio::buffer_size;
using net::buffer_copy;
using net::buffer_size;
reset();
auto const mb = beast::detail::dynamic_buffer_prepare(
rd_buf_, buffer_size(buffers), ec,
@@ -610,7 +610,7 @@ async_accept(
{
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
BOOST_BEAST_HANDLER_INIT(
@@ -643,7 +643,7 @@ async_accept_ex(
{
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
static_assert(detail::is_response_decorator<
@@ -678,7 +678,7 @@ async_accept(
BOOST_BEAST_HANDLER_INIT(
AcceptHandler, void(error_code));
reset();
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
response_op<
BOOST_ASIO_HANDLER_TYPE(
AcceptHandler, void(error_code))>{
@@ -710,7 +710,7 @@ async_accept_ex(
BOOST_BEAST_HANDLER_INIT(
AcceptHandler, void(error_code));
reset();
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
response_op<
BOOST_ASIO_HANDLER_TYPE(
AcceptHandler, void(error_code))>{
+14 -14
View File
@@ -39,12 +39,12 @@ namespace websocket {
template<class NextLayer, bool deflateSupported>
template<class Handler>
class stream<NextLayer, deflateSupported>::close_op
: public boost::asio::coroutine
: public net::coroutine
{
struct state
{
stream<NextLayer, deflateSupported>& ws;
boost::asio::executor_work_guard<decltype(std::declval<
net::executor_work_guard<decltype(std::declval<
stream<NextLayer, deflateSupported>&>().get_executor())> wg;
detail::frame_buffer fb;
error_code ev;
@@ -81,21 +81,21 @@ public:
}
using allocator_type =
boost::asio::associated_allocator_t<Handler>;
net::associated_allocator_t<Handler>;
allocator_type
get_allocator() const noexcept
{
return (boost::asio::get_associated_allocator)(d_.handler());
return (net::get_associated_allocator)(d_.handler());
}
using executor_type = boost::asio::associated_executor_t<
using executor_type = net::associated_executor_t<
Handler, decltype(std::declval<stream<NextLayer, deflateSupported>&>().get_executor())>;
executor_type
get_executor() const noexcept
{
return (boost::asio::get_associated_executor)(
return (net::get_associated_executor)(
d_.handler(), d_->ws.get_executor());
}
@@ -108,7 +108,7 @@ public:
friend
bool asio_handler_is_continuation(close_op* op)
{
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
return op->d_->cont || asio_handler_is_continuation(
std::addressof(op->d_.handler()));
}
@@ -117,7 +117,7 @@ public:
friend
void asio_handler_invoke(Function&& f, close_op* op)
{
using boost::asio::asio_handler_invoke;
using net::asio_handler_invoke;
asio_handler_invoke(f,
std::addressof(op->d_.handler()));
}
@@ -150,7 +150,7 @@ operator()(
// Resume
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
d.ws.get_executor(), std::move(*this));
BOOST_ASSERT(d.ws.wr_block_.is_locked(this));
}
@@ -169,7 +169,7 @@ operator()(
// Send close frame
d.ws.wr_close_ = true;
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(d.ws.stream_,
net::async_write(d.ws.stream_,
d.fb.data(), std::move(*this));
if(! d.ws.check_ok(ec))
goto upcall;
@@ -194,7 +194,7 @@ operator()(
// Resume
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
d.ws.get_executor(), std::move(*this));
BOOST_ASSERT(d.ws.rd_block_.is_locked(this));
@@ -277,7 +277,7 @@ operator()(
async_teardown(d.ws.role_,
d.ws.stream_, std::move(*this));
BOOST_ASSERT(d.ws.wr_block_.is_locked(this));
if(ec == boost::asio::error::eof)
if(ec == net::error::eof)
{
// Rationale:
// http://stackoverflow.com/questions/25587403/boost-asio-ssl-async-shutdown-always-finishes-with-an-error
@@ -302,7 +302,7 @@ operator()(
if(! d.cont)
{
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
d.ws.get_executor(),
beast::bind_front_handler(std::move(*this), ec));
}
@@ -347,7 +347,7 @@ close(close_reason const& cr, error_code& ec)
{
detail::frame_buffer fb;
write_close<flat_static_buffer_base>(fb, cr);
boost::asio::write(stream_, fb.data(), ec);
net::write(stream_, fb.data(), ec);
}
if(! check_ok(ec))
return;
@@ -38,12 +38,12 @@ namespace websocket {
template<class NextLayer, bool deflateSupported>
template<class Handler>
class stream<NextLayer, deflateSupported>::handshake_op
: public boost::asio::coroutine
: public net::coroutine
{
struct data
{
stream<NextLayer, deflateSupported>& ws;
boost::asio::executor_work_guard<decltype(std::declval<
net::executor_work_guard<decltype(std::declval<
stream<NextLayer, deflateSupported>&>().get_executor())> wg;
response_type* res_p;
detail::sec_ws_key_type key;
@@ -83,21 +83,21 @@ public:
}
using allocator_type =
boost::asio::associated_allocator_t<Handler>;
net::associated_allocator_t<Handler>;
allocator_type
get_allocator() const noexcept
{
return (boost::asio::get_associated_allocator)(d_.handler());
return (net::get_associated_allocator)(d_.handler());
}
using executor_type = boost::asio::associated_executor_t<
using executor_type = net::associated_executor_t<
Handler, decltype(std::declval<stream<NextLayer, deflateSupported>&>().get_executor())>;
executor_type
get_executor() const noexcept
{
return (boost::asio::get_associated_executor)(
return (net::get_associated_executor)(
d_.handler(), d_->ws.get_executor());
}
@@ -109,7 +109,7 @@ public:
friend
bool asio_handler_is_continuation(handshake_op* op)
{
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
return asio_handler_is_continuation(
std::addressof(op->d_.handler()));
}
@@ -118,7 +118,7 @@ public:
friend
void asio_handler_invoke(Function&& f, handshake_op* op)
{
using boost::asio::asio_handler_invoke;
using net::asio_handler_invoke;
asio_handler_invoke(f,
std::addressof(op->d_.handler()));
}
+13 -13
View File
@@ -37,12 +37,12 @@ namespace websocket {
template<class NextLayer, bool deflateSupported>
template<class Handler>
class stream<NextLayer, deflateSupported>::ping_op
: public boost::asio::coroutine
: public net::coroutine
{
struct state
{
stream<NextLayer, deflateSupported>& ws;
boost::asio::executor_work_guard<decltype(std::declval<
net::executor_work_guard<decltype(std::declval<
stream<NextLayer, deflateSupported>&>().get_executor())> wg;
detail::frame_buffer fb;
@@ -81,21 +81,21 @@ public:
}
using allocator_type =
boost::asio::associated_allocator_t<Handler>;
net::associated_allocator_t<Handler>;
allocator_type
get_allocator() const noexcept
{
return (boost::asio::get_associated_allocator)(d_.handler());
return (net::get_associated_allocator)(d_.handler());
}
using executor_type = boost::asio::associated_executor_t<
using executor_type = net::associated_executor_t<
Handler, decltype(std::declval<stream<NextLayer, deflateSupported>&>().get_executor())>;
executor_type
get_executor() const noexcept
{
return (boost::asio::get_associated_executor)(
return (net::get_associated_executor)(
d_.handler(), d_->ws.get_executor());
}
@@ -106,7 +106,7 @@ public:
friend
bool asio_handler_is_continuation(ping_op* op)
{
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
return asio_handler_is_continuation(
std::addressof(op->d_.handler()));
}
@@ -115,7 +115,7 @@ public:
friend
void asio_handler_invoke(Function&& f, ping_op* op)
{
using boost::asio::asio_handler_invoke;
using net::asio_handler_invoke;
asio_handler_invoke(
f, std::addressof(op->d_.handler()));
}
@@ -138,7 +138,7 @@ operator()(error_code ec, std::size_t)
if(! d.ws.check_open(ec))
{
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
d.ws.get_executor(),
beast::bind_front_handler(std::move(*this), ec));
goto upcall;
@@ -155,7 +155,7 @@ operator()(error_code ec, std::size_t)
// Resume
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
d.ws.get_executor(), std::move(*this));
BOOST_ASSERT(d.ws.wr_block_.is_locked(this));
@@ -166,7 +166,7 @@ operator()(error_code ec, std::size_t)
// Send ping frame
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(d.ws.stream_,
net::async_write(d.ws.stream_,
d.fb.data(), std::move(*this));
if(! d.ws.check_ok(ec))
goto upcall;
@@ -207,7 +207,7 @@ ping(ping_data const& payload, error_code& ec)
detail::frame_buffer fb;
write_ping<flat_static_buffer_base>(
fb, detail::opcode::ping, payload);
boost::asio::write(stream_, fb.data(), ec);
net::write(stream_, fb.data(), ec);
if(! check_ok(ec))
return;
}
@@ -234,7 +234,7 @@ pong(ping_data const& payload, error_code& ec)
detail::frame_buffer fb;
write_ping<flat_static_buffer_base>(
fb, detail::opcode::pong, payload);
boost::asio::write(stream_, fb.data(), ec);
net::write(stream_, fb.data(), ec);
if(! check_ok(ec))
return;
}
+45 -45
View File
@@ -80,11 +80,11 @@ template<
class MutableBufferSequence,
class Handler>
class stream<NextLayer, deflateSupported>::read_some_op
: public boost::asio::coroutine
: public net::coroutine
{
Handler h_;
stream<NextLayer, deflateSupported>& ws_;
boost::asio::executor_work_guard<decltype(std::declval<
net::executor_work_guard<decltype(std::declval<
stream<NextLayer, deflateSupported>&>().get_executor())> wg_;
MutableBufferSequence bs_;
buffers_suffix<MutableBufferSequence> cb_;
@@ -115,21 +115,21 @@ public:
}
using allocator_type =
boost::asio::associated_allocator_t<Handler>;
net::associated_allocator_t<Handler>;
allocator_type
get_allocator() const noexcept
{
return (boost::asio::get_associated_allocator)(h_);
return (net::get_associated_allocator)(h_);
}
using executor_type = boost::asio::associated_executor_t<
using executor_type = net::associated_executor_t<
Handler, decltype(std::declval<stream<NextLayer, deflateSupported>&>().get_executor())>;
executor_type
get_executor() const noexcept
{
return (boost::asio::get_associated_executor)(
return (net::get_associated_executor)(
h_, ws_.get_executor());
}
@@ -147,7 +147,7 @@ public:
friend
bool asio_handler_is_continuation(read_some_op* op)
{
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
return op->cont_ || asio_handler_is_continuation(
std::addressof(op->h_));
}
@@ -156,7 +156,7 @@ public:
friend
void asio_handler_invoke(Function&& f, read_some_op* op)
{
using boost::asio::asio_handler_invoke;
using net::asio_handler_invoke;
asio_handler_invoke(f, std::addressof(op->h_));
}
};
@@ -172,8 +172,8 @@ operator()(
bool cont)
{
using beast::detail::clamp;
using boost::asio::buffer;
using boost::asio::buffer_size;
using net::buffer;
using net::buffer_size;
cont_ = cont;
BOOST_ASIO_CORO_REENTER(*this)
{
@@ -185,7 +185,7 @@ operator()(
if( ws_.status_ == status::closed ||
ws_.status_ == status::failed)
{
ec = boost::asio::error::operation_aborted;
ec = net::error::operation_aborted;
goto upcall;
}
}
@@ -201,7 +201,7 @@ operator()(
// Resume
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
ws_.get_executor(), std::move(*this));
BOOST_ASSERT(ws_.rd_block_.is_locked(this));
@@ -209,7 +209,7 @@ operator()(
// a `close_op` wrote a close frame
BOOST_ASSERT(ws_.wr_close_);
BOOST_ASSERT(ws_.status_ != status::open);
ec = boost::asio::error::operation_aborted;
ec = net::error::operation_aborted;
goto upcall;
}
@@ -283,7 +283,7 @@ operator()(
if(! cont_)
{
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
ws_.get_executor(),
std::move(*this));
BOOST_ASSERT(cont_);
@@ -327,7 +327,7 @@ operator()(
// Resume
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
ws_.get_executor(), std::move(*this));
BOOST_ASSERT(ws_.wr_block_.is_locked(this));
@@ -339,7 +339,7 @@ operator()(
// Send pong
BOOST_ASSERT(ws_.wr_block_.is_locked(this));
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(ws_.stream_,
net::async_write(ws_.stream_,
ws_.rd_fb_.data(), std::move(*this));
BOOST_ASSERT(ws_.wr_block_.is_locked(this));
if(! ws_.check_ok(ec))
@@ -359,7 +359,7 @@ operator()(
if(! cont_)
{
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
ws_.get_executor(),
std::move(*this));
BOOST_ASSERT(cont_);
@@ -385,7 +385,7 @@ operator()(
if(! cont_)
{
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
ws_.get_executor(),
std::move(*this));
BOOST_ASSERT(cont_);
@@ -461,7 +461,7 @@ operator()(
{
// Copy from the read buffer.
// The mask was already applied.
bytes_transferred = boost::asio::buffer_copy(cb_,
bytes_transferred = net::buffer_copy(cb_,
ws_.rd_buf_.data(), clamp(ws_.rd_remain_));
auto const mb = buffers_prefix(
bytes_transferred, cb_);
@@ -639,7 +639,7 @@ operator()(
// Resume
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
ws_.get_executor(), std::move(*this));
BOOST_ASSERT(ws_.wr_block_.is_locked(this));
@@ -664,7 +664,7 @@ operator()(
// Send close frame
BOOST_ASSERT(ws_.wr_block_.is_locked(this));
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(
net::async_write(
ws_.stream_, ws_.rd_fb_.data(),
std::move(*this));
BOOST_ASSERT(ws_.wr_block_.is_locked(this));
@@ -679,7 +679,7 @@ operator()(
async_teardown(ws_.role_,
ws_.stream_, std::move(*this));
BOOST_ASSERT(ws_.wr_block_.is_locked(this));
if(ec == boost::asio::error::eof)
if(ec == net::error::eof)
{
// Rationale:
// http://stackoverflow.com/questions/25587403/boost-asio-ssl-async-shutdown-always-finishes-with-an-error
@@ -703,7 +703,7 @@ operator()(
if(! cont_)
{
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
ws_.get_executor(),
beast::bind_front_handler(std::move(*this),
ec, bytes_written_));
@@ -719,11 +719,11 @@ template<
class DynamicBuffer,
class Handler>
class stream<NextLayer, deflateSupported>::read_op
: public boost::asio::coroutine
: public net::coroutine
{
Handler h_;
stream<NextLayer, deflateSupported>& ws_;
boost::asio::executor_work_guard<decltype(std::declval<
net::executor_work_guard<decltype(std::declval<
stream<NextLayer, deflateSupported>&>().get_executor())> wg_;
DynamicBuffer& b_;
std::size_t limit_;
@@ -732,7 +732,7 @@ class stream<NextLayer, deflateSupported>::read_op
public:
using allocator_type =
boost::asio::associated_allocator_t<Handler>;
net::associated_allocator_t<Handler>;
read_op(read_op&&) = default;
read_op(read_op const&) = delete;
@@ -757,16 +757,16 @@ public:
allocator_type
get_allocator() const noexcept
{
return (boost::asio::get_associated_allocator)(h_);
return (net::get_associated_allocator)(h_);
}
using executor_type = boost::asio::associated_executor_t<
using executor_type = net::associated_executor_t<
Handler, decltype(std::declval<stream<NextLayer, deflateSupported>&>().get_executor())>;
executor_type
get_executor() const noexcept
{
return (boost::asio::get_associated_executor)(
return (net::get_associated_executor)(
h_, ws_.get_executor());
}
@@ -777,7 +777,7 @@ public:
friend
bool asio_handler_is_continuation(read_op* op)
{
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
return asio_handler_is_continuation(
std::addressof(op->h_));
}
@@ -786,7 +786,7 @@ public:
friend
void asio_handler_invoke(Function&& f, read_op* op)
{
using boost::asio::asio_handler_invoke;
using net::asio_handler_invoke;
asio_handler_invoke(f, std::addressof(op->h_));
}
};
@@ -811,7 +811,7 @@ operator()(
clamp(ws_.read_size_hint(b_), limit_),
ec, error::buffer_overflow);
if(ec)
boost::asio::post(
net::post(
ws_.get_executor(),
beast::bind_front_handler(
std::move(*this), ec, 0));
@@ -843,7 +843,7 @@ read(DynamicBuffer& buffer)
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(
boost::asio::is_dynamic_buffer<DynamicBuffer>::value,
net::is_dynamic_buffer<DynamicBuffer>::value,
"DynamicBuffer requirements not met");
error_code ec;
auto const bytes_written = read(buffer, ec);
@@ -861,7 +861,7 @@ read(DynamicBuffer& buffer, error_code& ec)
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(
boost::asio::is_dynamic_buffer<DynamicBuffer>::value,
net::is_dynamic_buffer<DynamicBuffer>::value,
"DynamicBuffer requirements not met");
std::size_t bytes_written = 0;
do
@@ -884,7 +884,7 @@ async_read(DynamicBuffer& buffer, ReadHandler&& handler)
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream requirements not met");
static_assert(
boost::asio::is_dynamic_buffer<DynamicBuffer>::value,
net::is_dynamic_buffer<DynamicBuffer>::value,
"DynamicBuffer requirements not met");
BOOST_BEAST_HANDLER_INIT(
ReadHandler, void(error_code, std::size_t));
@@ -913,7 +913,7 @@ read_some(
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(
boost::asio::is_dynamic_buffer<DynamicBuffer>::value,
net::is_dynamic_buffer<DynamicBuffer>::value,
"DynamicBuffer requirements not met");
error_code ec;
auto const bytes_written =
@@ -935,7 +935,7 @@ read_some(
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(
boost::asio::is_dynamic_buffer<DynamicBuffer>::value,
net::is_dynamic_buffer<DynamicBuffer>::value,
"DynamicBuffer requirements not met");
using beast::detail::clamp;
if(! limit)
@@ -965,7 +965,7 @@ async_read_some(
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream requirements not met");
static_assert(
boost::asio::is_dynamic_buffer<DynamicBuffer>::value,
net::is_dynamic_buffer<DynamicBuffer>::value,
"DynamicBuffer requirements not met");
BOOST_BEAST_HANDLER_INIT(
ReadHandler, void(error_code, std::size_t));
@@ -992,7 +992,7 @@ read_some(
{
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(boost::asio::is_mutable_buffer_sequence<
static_assert(net::is_mutable_buffer_sequence<
MutableBufferSequence>::value,
"MutableBufferSequence requirements not met");
error_code ec;
@@ -1012,12 +1012,12 @@ read_some(
{
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(boost::asio::is_mutable_buffer_sequence<
static_assert(net::is_mutable_buffer_sequence<
MutableBufferSequence>::value,
"MutableBufferSequence requirements not met");
using beast::detail::clamp;
using boost::asio::buffer;
using boost::asio::buffer_size;
using net::buffer;
using net::buffer_size;
close_code code{};
std::size_t bytes_written = 0;
ec.assign(0, ec.category());
@@ -1088,7 +1088,7 @@ loop:
detail::frame_buffer fb;
write_ping<flat_static_buffer_base>(fb,
detail::opcode::pong, payload);
boost::asio::write(stream_, fb.data(), ec);
net::write(stream_, fb.data(), ec);
if(! check_ok(ec))
return bytes_written;
goto loop;
@@ -1167,7 +1167,7 @@ loop:
// Copy from the read buffer.
// The mask was already applied.
auto const bytes_transferred =
boost::asio::buffer_copy(buffers,
net::buffer_copy(buffers,
rd_buf_.data(), clamp(rd_remain_));
auto const mb = buffers_prefix(
bytes_transferred, buffers);
@@ -1349,7 +1349,7 @@ async_read_some(
{
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream requirements not met");
static_assert(boost::asio::is_mutable_buffer_sequence<
static_assert(net::is_mutable_buffer_sequence<
MutableBufferSequence>::value,
"MutableBufferSequence requirements not met");
BOOST_BEAST_HANDLER_INIT(
+2 -2
View File
@@ -35,7 +35,7 @@ template<class AsyncStream>
void
teardown(
role_type,
boost::asio::ssl::stream<AsyncStream>& stream,
net::ssl::stream<AsyncStream>& stream,
error_code& ec)
{
stream.shutdown(ec);
@@ -47,7 +47,7 @@ template<
void
async_teardown(
role_type,
boost::asio::ssl::stream<AsyncStream>& stream,
net::ssl::stream<AsyncStream>& stream,
TeardownHandler&& handler)
{
stream.async_shutdown(
+12 -12
View File
@@ -57,7 +57,7 @@ stream<NextLayer, deflateSupported>::
read_size_hint(DynamicBuffer& buffer) const
{
static_assert(
boost::asio::is_dynamic_buffer<DynamicBuffer>::value,
net::is_dynamic_buffer<DynamicBuffer>::value,
"DynamicBuffer requirements not met");
auto const initial_size = (std::min)(
+tcp_frame_size,
@@ -169,9 +169,9 @@ parse_fh(
DynamicBuffer& b,
error_code& ec)
{
using boost::asio::buffer;
using boost::asio::buffer_copy;
using boost::asio::buffer_size;
using net::buffer;
using net::buffer_copy;
using net::buffer_size;
if(buffer_size(b.data()) < 2)
{
// need more bytes
@@ -403,8 +403,8 @@ write_close(DynamicBuffer& db, close_reason const& cr)
::new(&tmp[0]) big_uint16_buf_t{
(std::uint16_t)cr.code};
auto mb = db.prepare(2);
boost::asio::buffer_copy(mb,
boost::asio::buffer(tmp));
net::buffer_copy(mb,
net::buffer(tmp));
if(fh.mask)
detail::mask_inplace(mb, key);
db.commit(2);
@@ -412,8 +412,8 @@ write_close(DynamicBuffer& db, close_reason const& cr)
if(! cr.reason.empty())
{
auto mb = db.prepare(cr.reason.size());
boost::asio::buffer_copy(mb,
boost::asio::const_buffer(
net::buffer_copy(mb,
net::const_buffer(
cr.reason.data(), cr.reason.size()));
if(fh.mask)
detail::mask_inplace(mb, key);
@@ -446,8 +446,8 @@ write_ping(DynamicBuffer& db,
if(fh.mask)
detail::prepare_key(key, fh.key);
auto mb = db.prepare(data.size());
boost::asio::buffer_copy(mb,
boost::asio::const_buffer(
net::buffer_copy(mb,
net::const_buffer(
data.data(), data.size()));
if(fh.mask)
detail::mask_inplace(mb, key);
@@ -642,13 +642,13 @@ do_fail(
detail::frame_buffer fb;
write_close<
flat_static_buffer_base>(fb, code);
boost::asio::write(stream_, fb.data(), ec);
net::write(stream_, fb.data(), ec);
if(! check_ok(ec))
return;
}
using beast::websocket::teardown;
teardown(role_, stream_, ec);
if(ec == boost::asio::error::eof)
if(ec == net::error::eof)
{
// Rationale:
// http://stackoverflow.com/questions/25587403/boost-asio-ssl-async-shutdown-always-finishes-with-an-error
+22 -22
View File
@@ -28,14 +28,14 @@ namespace websocket {
namespace detail {
template<class Handler>
class teardown_tcp_op : public boost::asio::coroutine
class teardown_tcp_op : public net::coroutine
{
using socket_type =
boost::asio::ip::tcp::socket;
net::ip::tcp::socket;
Handler h_;
socket_type& s_;
boost::asio::executor_work_guard<decltype(std::declval<
net::executor_work_guard<decltype(std::declval<
socket_type&>().get_executor())> wg_;
role_type role_;
bool nb_;
@@ -57,21 +57,21 @@ public:
}
using allocator_type =
boost::asio::associated_allocator_t<Handler>;
net::associated_allocator_t<Handler>;
allocator_type
get_allocator() const noexcept
{
return (boost::asio::get_associated_allocator)(h_);
return (net::get_associated_allocator)(h_);
}
using executor_type = boost::asio::associated_executor_t<
using executor_type = net::associated_executor_t<
Handler, decltype(std::declval<socket_type&>().get_executor())>;
executor_type
get_executor() const noexcept
{
return (boost::asio::get_associated_executor)(
return (net::get_associated_executor)(
h_, s_.get_executor());
}
@@ -83,7 +83,7 @@ public:
friend
bool asio_handler_is_continuation(teardown_tcp_op* op)
{
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
return asio_handler_is_continuation(
std::addressof(op->h_));
}
@@ -92,7 +92,7 @@ public:
friend
void asio_handler_invoke(Function&& f, teardown_tcp_op* op)
{
using boost::asio::asio_handler_invoke;
using net::asio_handler_invoke;
asio_handler_invoke(f, std::addressof(op->h_));
}
};
@@ -102,8 +102,8 @@ void
teardown_tcp_op<Handler>::
operator()(error_code ec, std::size_t bytes_transferred)
{
using boost::asio::buffer;
using tcp = boost::asio::ip::tcp;
using net::buffer;
using tcp = net::ip::tcp;
BOOST_ASIO_CORO_REENTER(*this)
{
nb_ = s_.non_blocking();
@@ -116,7 +116,7 @@ operator()(error_code ec, std::size_t bytes_transferred)
if(ec)
{
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
s_.get_executor(),
beast::bind_front_handler(std::move(*this), ec, 0));
goto upcall;
@@ -126,19 +126,19 @@ operator()(error_code ec, std::size_t bytes_transferred)
{
char buf[2048];
s_.read_some(
boost::asio::buffer(buf), ec);
net::buffer(buf), ec);
}
if(ec == boost::asio::error::would_block)
if(ec == net::error::would_block)
{
BOOST_ASIO_CORO_YIELD
s_.async_wait(
boost::asio::ip::tcp::socket::wait_read,
net::ip::tcp::socket::wait_read,
std::move(*this));
continue;
}
if(ec)
{
if(ec != boost::asio::error::eof)
if(ec != net::error::eof)
goto upcall;
ec = {};
break;
@@ -171,13 +171,13 @@ inline
void
teardown(
role_type role,
boost::asio::ip::tcp::socket& socket,
net::ip::tcp::socket& socket,
error_code& ec)
{
using boost::asio::buffer;
using net::buffer;
if(role == role_type::server)
socket.shutdown(
boost::asio::ip::tcp::socket::shutdown_send, ec);
net::ip::tcp::socket::shutdown_send, ec);
if(ec)
return;
for(;;)
@@ -187,7 +187,7 @@ teardown(
socket.read_some(buffer(buf), ec);
if(ec)
{
if(ec != boost::asio::error::eof)
if(ec != net::error::eof)
return;
ec = {};
break;
@@ -200,7 +200,7 @@ teardown(
}
if(role == role_type::client)
socket.shutdown(
boost::asio::ip::tcp::socket::shutdown_send, ec);
net::ip::tcp::socket::shutdown_send, ec);
if(ec)
return;
socket.close(ec);
@@ -211,7 +211,7 @@ inline
void
async_teardown(
role_type role,
boost::asio::ip::tcp::socket& socket,
net::ip::tcp::socket& socket,
TeardownHandler&& handler)
{
static_assert(beast::is_completion_handler<
+39 -39
View File
@@ -46,13 +46,13 @@ template<class ConstBufferSequence>
bool
stream_base<true>::
deflate(
boost::asio::mutable_buffer& out,
net::mutable_buffer& out,
buffers_suffix<ConstBufferSequence>& cb,
bool fin,
std::size_t& total_in,
error_code& ec)
{
using boost::asio::buffer;
using net::buffer;
BOOST_ASSERT(out.size() >= 6);
auto& zo = this->pmd_->zo;
zlib::z_params zs;
@@ -87,7 +87,7 @@ deflate(
cb.consume(zs.total_in);
if(zs.avail_out > 0 && fin)
{
auto const remain = boost::asio::buffer_size(cb);
auto const remain = net::buffer_size(cb);
if(remain == 0)
{
// Inspired by Mark Adler
@@ -139,11 +139,11 @@ do_context_takeover_write(role_type role)
template<class NextLayer, bool deflateSupported>
template<class Buffers, class Handler>
class stream<NextLayer, deflateSupported>::write_some_op
: public boost::asio::coroutine
: public net::coroutine
{
Handler h_;
stream<NextLayer, deflateSupported>& ws_;
boost::asio::executor_work_guard<decltype(std::declval<
net::executor_work_guard<decltype(std::declval<
stream<NextLayer, deflateSupported>&>().get_executor())> wg_;
buffers_suffix<Buffers> cb_;
detail::frame_header fh_;
@@ -177,21 +177,21 @@ public:
}
using allocator_type =
boost::asio::associated_allocator_t<Handler>;
net::associated_allocator_t<Handler>;
allocator_type
get_allocator() const noexcept
{
return (boost::asio::get_associated_allocator)(h_);
return (net::get_associated_allocator)(h_);
}
using executor_type = boost::asio::associated_executor_t<
using executor_type = net::associated_executor_t<
Handler, decltype(std::declval<stream<NextLayer, deflateSupported>&>().get_executor())>;
executor_type
get_executor() const noexcept
{
return (boost::asio::get_associated_executor)(
return (net::get_associated_executor)(
h_, ws_.get_executor());
}
@@ -209,7 +209,7 @@ public:
friend
bool asio_handler_is_continuation(write_some_op* op)
{
using boost::asio::asio_handler_is_continuation;
using net::asio_handler_is_continuation;
return op->cont_ || asio_handler_is_continuation(
std::addressof(op->h_));
}
@@ -218,7 +218,7 @@ public:
friend
void asio_handler_invoke(Function&& f, write_some_op* op)
{
using boost::asio::asio_handler_invoke;
using net::asio_handler_invoke;
asio_handler_invoke(
f, std::addressof(op->h_));
}
@@ -235,10 +235,10 @@ operator()(
bool cont)
{
using beast::detail::clamp;
using boost::asio::buffer;
using boost::asio::buffer_copy;
using boost::asio::buffer_size;
using boost::asio::mutable_buffer;
using net::buffer;
using net::buffer_copy;
using net::buffer_size;
using net::mutable_buffer;
enum
{
do_nomask_nofrag,
@@ -248,7 +248,7 @@ operator()(
do_deflate
};
std::size_t n;
boost::asio::mutable_buffer b;
net::mutable_buffer b;
cont_ = cont;
BOOST_ASIO_CORO_REENTER(*this)
{
@@ -326,7 +326,7 @@ operator()(
// Resume
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
ws_.get_executor(), std::move(*this));
BOOST_ASSERT(ws_.wr_block_.is_locked(this));
@@ -347,7 +347,7 @@ operator()(
ws_.wr_cont_ = ! fin_;
// Send frame
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(ws_.stream_,
net::async_write(ws_.stream_,
buffers_cat(ws_.wr_fb_.data(), cb_),
std::move(*this));
if(! ws_.check_ok(ec))
@@ -372,7 +372,7 @@ operator()(
ws_.wr_cont_ = ! fin_;
// Send frame
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(
net::async_write(
ws_.stream_, buffers_cat(
ws_.wr_fb_.data(), buffers_prefix(
clamp(fh_.len), cb_)),
@@ -421,7 +421,7 @@ operator()(
ws_.wr_cont_ = ! fin_;
// Send frame header and partial payload
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(
net::async_write(
ws_.stream_, buffers_cat(ws_.wr_fb_.data(),
buffer(ws_.wr_buf_.get(), n)),
std::move(*this));
@@ -440,7 +440,7 @@ operator()(
remain_ -= n;
// Send partial payload
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(ws_.stream_,
net::async_write(ws_.stream_,
buffer(ws_.wr_buf_.get(), n),
std::move(*this));
if(! ws_.check_ok(ec))
@@ -472,7 +472,7 @@ operator()(
ws_.wr_cont_ = ! fin_;
// Send frame
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(ws_.stream_,
net::async_write(ws_.stream_,
buffers_cat(ws_.wr_fb_.data(),
buffer(ws_.wr_buf_.get(), n)),
std::move(*this));
@@ -535,7 +535,7 @@ operator()(
ws_.wr_cont_ = ! fin_;
// Send frame
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(ws_.stream_,
net::async_write(ws_.stream_,
buffers_cat(ws_.wr_fb_.data(), b),
std::move(*this));
if(! ws_.check_ok(ec))
@@ -576,7 +576,7 @@ operator()(
if(! cont_)
{
BOOST_ASIO_CORO_YIELD
boost::asio::post(
net::post(
ws_.get_executor(),
beast::bind_front_handler(
std::move(*this),
@@ -596,7 +596,7 @@ write_some(bool fin, ConstBufferSequence const& buffers)
{
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
error_code ec;
@@ -616,13 +616,13 @@ write_some(bool fin,
{
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
using beast::detail::clamp;
using boost::asio::buffer;
using boost::asio::buffer_copy;
using boost::asio::buffer_size;
using net::buffer;
using net::buffer_copy;
using net::buffer_size;
std::size_t bytes_transferred = 0;
ec.assign(0, ec.category());
// Make sure the stream is open
@@ -680,7 +680,7 @@ write_some(bool fin,
detail::write<
flat_static_buffer_base>(fh_buf, fh);
wr_cont_ = ! fin;
boost::asio::write(stream_,
net::write(stream_,
buffers_cat(fh_buf.data(), b), ec);
if(! check_ok(ec))
return bytes_transferred;
@@ -703,7 +703,7 @@ write_some(bool fin,
detail::write<
flat_static_buffer_base>(fh_buf, fh);
wr_cont_ = ! fin;
boost::asio::write(stream_,
net::write(stream_,
buffers_cat(fh_buf.data(), buffers), ec);
if(! check_ok(ec))
return bytes_transferred;
@@ -725,7 +725,7 @@ write_some(bool fin,
detail::write<
flat_static_buffer_base>(fh_buf, fh);
wr_cont_ = ! fin;
boost::asio::write(stream_,
net::write(stream_,
buffers_cat(fh_buf.data(),
buffers_prefix(n, cb)), ec);
if(! check_ok(ec))
@@ -759,7 +759,7 @@ write_some(bool fin,
remain -= n;
detail::mask_inplace(b, key);
wr_cont_ = ! fin;
boost::asio::write(stream_,
net::write(stream_,
buffers_cat(fh_buf.data(), b), ec);
if(! check_ok(ec))
return bytes_transferred;
@@ -773,7 +773,7 @@ write_some(bool fin,
cb.consume(n);
remain -= n;
detail::mask_inplace(b, key);
boost::asio::write(stream_, b, ec);
net::write(stream_, b, ec);
if(! check_ok(ec))
return bytes_transferred;
bytes_transferred += n;
@@ -801,7 +801,7 @@ write_some(bool fin,
detail::fh_buffer fh_buf;
detail::write<
flat_static_buffer_base>(fh_buf, fh);
boost::asio::write(stream_,
net::write(stream_,
buffers_cat(fh_buf.data(), b), ec);
if(! check_ok(ec))
return bytes_transferred;
@@ -825,7 +825,7 @@ async_write_some(bool fin,
{
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
BOOST_BEAST_HANDLER_INIT(
@@ -847,7 +847,7 @@ write(ConstBufferSequence const& buffers)
{
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
error_code ec;
@@ -865,7 +865,7 @@ write(ConstBufferSequence const& buffers, error_code& ec)
{
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
return write_some(true, buffers, ec);
@@ -881,7 +881,7 @@ async_write(
{
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream requirements not met");
static_assert(boost::asio::is_const_buffer_sequence<
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence requirements not met");
BOOST_BEAST_HANDLER_INIT(