update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -38,7 +38,7 @@ template<class Handler>
class stream<NextLayer, deflateSupported>::close_op
: public beast::stable_async_base<
Handler, beast::executor_type<stream>>
, public net::coroutine
, public asio::coroutine
{
boost::weak_ptr<impl_type> wp_;
error_code ev_;
@@ -76,7 +76,7 @@ public:
auto sp = wp_.lock();
if(! sp)
{
ec = net::error::operation_aborted;
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
return this->complete(cont, ec);
}
auto& impl = *sp;
@@ -86,10 +86,28 @@ public:
if(! impl.wr_block.try_lock(this))
{
BOOST_ASIO_CORO_YIELD
impl.op_close.emplace(std::move(*this));
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"websocket::async_close"));
this->set_allowed_cancellation(net::cancellation_type::all);
impl.op_close.emplace(std::move(*this),
net::cancellation_type::all);
}
// cancel fired before we could do anything.
if (ec == net::error::operation_aborted)
return this->complete(cont, ec);
this->set_allowed_cancellation(net::cancellation_type::terminal);
impl.wr_block.lock(this);
BOOST_ASIO_CORO_YIELD
net::post(std::move(*this));
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"websocket::async_close"));
net::post(sp->stream().get_executor(), std::move(*this));
}
BOOST_ASSERT(impl.wr_block.is_locked(this));
}
if(impl.check_stop_now(ec))
@@ -104,8 +122,14 @@ public:
impl.change_status(status::closing);
impl.update_timer(this->get_executor());
BOOST_ASIO_CORO_YIELD
net::async_write(impl.stream(), fb_.data(),
beast::detail::bind_continuation(std::move(*this)));
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"websocket::async_close"));
net::async_write(impl.stream(), fb_.data(),
beast::detail::bind_continuation(std::move(*this)));
}
if(impl.check_stop_now(ec))
goto upcall;
@@ -121,10 +145,30 @@ public:
if(! impl.rd_block.try_lock(this))
{
BOOST_ASIO_CORO_YIELD
impl.op_r_close.emplace(std::move(*this));
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"websocket::async_close"));
// terminal only, that's the default
impl.op_r_close.emplace(std::move(*this));
}
if (ec == net::error::operation_aborted)
{
// if a cancellation fires here, we do a dirty shutdown
impl.change_status(status::closed);
close_socket(get_lowest_layer(impl.stream()));
return this->complete(cont, ec);
}
impl.rd_block.lock(this);
BOOST_ASIO_CORO_YIELD
net::post(std::move(*this));
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"websocket::async_close"));
net::post(sp->stream().get_executor(), std::move(*this));
}
BOOST_ASSERT(impl.rd_block.is_locked(this));
if(impl.check_stop_now(ec))
goto upcall;
@@ -144,12 +188,18 @@ public:
if(ev_)
goto teardown;
BOOST_ASIO_CORO_YIELD
impl.stream().async_read_some(
impl.rd_buf.prepare(read_size(
impl.rd_buf, impl.rd_buf.max_size())),
beast::detail::bind_continuation(std::move(*this)));
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"websocket::async_close"));
impl.stream().async_read_some(
impl.rd_buf.prepare(read_size(
impl.rd_buf, impl.rd_buf.max_size())),
beast::detail::bind_continuation(std::move(*this)));
}
impl.rd_buf.commit(bytes_transferred);
if(impl.check_stop_now(ec))
if(impl.check_stop_now(ec)) //< this catches cancellation
goto upcall;
}
if(detail::is_control(impl.rd_fh.op))
@@ -184,10 +234,16 @@ public:
impl.rd_remain -= impl.rd_buf.size();
impl.rd_buf.consume(impl.rd_buf.size());
BOOST_ASIO_CORO_YIELD
impl.stream().async_read_some(
impl.rd_buf.prepare(read_size(
impl.rd_buf, impl.rd_buf.max_size())),
beast::detail::bind_continuation(std::move(*this)));
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"websocket::async_close"));
impl.stream().async_read_some(
impl.rd_buf.prepare(read_size(
impl.rd_buf, impl.rd_buf.max_size())),
beast::detail::bind_continuation(std::move(*this)));
}
impl.rd_buf.commit(bytes_transferred);
if(impl.check_stop_now(ec))
goto upcall;
@@ -202,8 +258,14 @@ public:
BOOST_ASSERT(impl.wr_block.is_locked(this));
using beast::websocket::async_teardown;
BOOST_ASIO_CORO_YIELD
async_teardown(impl.role, impl.stream(),
beast::detail::bind_continuation(std::move(*this)));
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"websocket::async_close"));
async_teardown(impl.role, impl.stream(),
beast::detail::bind_continuation(std::move(*this)));
}
BOOST_ASSERT(impl.wr_block.is_locked(this));
if(ec == net::error::eof)
{
@@ -212,7 +274,9 @@ public:
ec = {};
}
if(! ec)
ec = ev_;
{
BOOST_BEAST_ASSIGN_EC(ec, ev_);
}
if(ec)
impl.change_status(status::failed);
else
@@ -382,7 +446,7 @@ close(close_reason const& cr, error_code& ec)
}
template<class NextLayer, bool deflateSupported>
template<class CloseHandler>
template<BOOST_BEAST_ASYNC_TPARAM1 CloseHandler>
BOOST_BEAST_ASYNC_RESULT1(CloseHandler)
stream<NextLayer, deflateSupported>::
async_close(close_reason const& cr, CloseHandler&& handler)