mirror of
https://github.com/boostorg/beast.git
synced 2025-08-01 05:44:38 +02:00
Add handler tracking locations to websocket
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
Version XXX:
|
||||
|
||||
* Add handler tracking locations to websocket.
|
||||
* Add handler tracking locations to tcp teardown.
|
||||
* Eliminate spurious uninitialised variable warning in detect_ssl.
|
||||
* Add handler tracking locations to flat_stream.
|
||||
|
@@ -215,8 +215,14 @@ public:
|
||||
|
||||
// Send response
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
http::async_write(
|
||||
impl.stream(), res_, std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_accept"));
|
||||
|
||||
http::async_write(
|
||||
impl.stream(), res_, std::move(*this));
|
||||
}
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
if(! ec)
|
||||
@@ -298,8 +304,14 @@ public:
|
||||
goto upcall;
|
||||
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
http::async_read(impl.stream(),
|
||||
impl.rd_buf, p_, std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_accept"));
|
||||
|
||||
http::async_read(impl.stream(),
|
||||
impl.rd_buf, p_, std::move(*this));
|
||||
}
|
||||
if(ec == http::error::end_of_stream)
|
||||
ec = error::closed;
|
||||
if(impl.check_stop_now(ec))
|
||||
|
@@ -86,10 +86,22 @@ 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"));
|
||||
|
||||
impl.op_close.emplace(std::move(*this));
|
||||
}
|
||||
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(std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
}
|
||||
if(impl.check_stop_now(ec))
|
||||
@@ -104,8 +116,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 +139,22 @@ 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"));
|
||||
|
||||
impl.op_r_close.emplace(std::move(*this));
|
||||
}
|
||||
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(std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(impl.rd_block.is_locked(this));
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
@@ -144,10 +174,16 @@ 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))
|
||||
goto upcall;
|
||||
@@ -184,10 +220,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 +244,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)
|
||||
{
|
||||
|
@@ -105,16 +105,28 @@ public:
|
||||
// write HTTP request
|
||||
impl.do_pmd_config(d_.req);
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
http::async_write(impl.stream(),
|
||||
d_.req, std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_handshake"));
|
||||
|
||||
http::async_write(impl.stream(),
|
||||
d_.req, std::move(*this));
|
||||
}
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
|
||||
// read HTTP response
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
http::async_read(impl.stream(),
|
||||
impl.rd_buf, d_.p,
|
||||
std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_handshake"));
|
||||
|
||||
http::async_read(impl.stream(),
|
||||
impl.rd_buf, d_.p,
|
||||
std::move(*this));
|
||||
}
|
||||
if(ec == http::error::buffer_overflow)
|
||||
{
|
||||
// If the response overflows the internal
|
||||
@@ -127,8 +139,14 @@ public:
|
||||
impl.rd_buf.clear();
|
||||
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
http::async_read(impl.stream(),
|
||||
d_.fb, d_.p, std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_handshake"));
|
||||
|
||||
http::async_read(impl.stream(),
|
||||
d_.fb, d_.p, std::move(*this));
|
||||
}
|
||||
|
||||
if(! ec)
|
||||
{
|
||||
|
@@ -82,10 +82,22 @@ public:
|
||||
if(! impl.wr_block.try_lock(this))
|
||||
{
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
impl.op_ping.emplace(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_ping"));
|
||||
|
||||
impl.op_ping.emplace(std::move(*this));
|
||||
}
|
||||
impl.wr_block.lock(this);
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::post(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_ping"));
|
||||
|
||||
net::post(std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
}
|
||||
if(impl.check_stop_now(ec))
|
||||
@@ -93,8 +105,14 @@ public:
|
||||
|
||||
// Send ping frame
|
||||
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_ping"));
|
||||
|
||||
net::async_write(impl.stream(), fb_.data(),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
}
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
|
||||
@@ -173,11 +191,23 @@ public:
|
||||
if(! impl.wr_block.try_lock(this))
|
||||
{
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
impl.op_idle_ping.emplace(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_ping"));
|
||||
|
||||
impl.op_idle_ping.emplace(std::move(*this));
|
||||
}
|
||||
impl.wr_block.lock(this);
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::post(
|
||||
this->get_executor(), std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_ping"));
|
||||
|
||||
net::post(
|
||||
this->get_executor(), std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
}
|
||||
if(impl.check_stop_now(ec))
|
||||
@@ -185,9 +215,14 @@ public:
|
||||
|
||||
// Send ping frame
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::async_write(impl.stream(), fb_->data(),
|
||||
//beast::detail::bind_continuation(std::move(*this)));
|
||||
std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_ping"));
|
||||
|
||||
net::async_write(impl.stream(), fb_->data(),
|
||||
std::move(*this));
|
||||
}
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
|
||||
|
@@ -102,10 +102,22 @@ public:
|
||||
{
|
||||
do_suspend:
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
impl.op_r_rd.emplace(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
impl.op_r_rd.emplace(std::move(*this));
|
||||
}
|
||||
impl.rd_block.lock(this);
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::post(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
net::post(std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(impl.rd_block.is_locked(this));
|
||||
|
||||
BOOST_ASSERT(!ec);
|
||||
@@ -162,10 +174,16 @@ public:
|
||||
}
|
||||
BOOST_ASSERT(impl.rd_block.is_locked(this));
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
impl.stream().async_read_some(
|
||||
impl.rd_buf.prepare(read_size(
|
||||
impl.rd_buf, impl.rd_buf.max_size())),
|
||||
std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
impl.stream().async_read_some(
|
||||
impl.rd_buf.prepare(read_size(
|
||||
impl.rd_buf, impl.rd_buf.max_size())),
|
||||
std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(impl.rd_block.is_locked(this));
|
||||
impl.rd_buf.commit(bytes_transferred);
|
||||
if(impl.check_stop_now(ec))
|
||||
@@ -205,7 +223,13 @@ public:
|
||||
if(! cont)
|
||||
{
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::post(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
net::post(std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(cont);
|
||||
// VFALCO call check_stop_now() here?
|
||||
}
|
||||
@@ -240,10 +264,22 @@ public:
|
||||
if(! impl.wr_block.try_lock(this))
|
||||
{
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
impl.op_rd.emplace(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
impl.op_rd.emplace(std::move(*this));
|
||||
}
|
||||
impl.wr_block.lock(this);
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::post(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
net::post(std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
@@ -252,9 +288,15 @@ public:
|
||||
// Send pong
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::async_write(
|
||||
impl.stream(), impl.rd_fb.data(),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
net::async_write(
|
||||
impl.stream(), impl.rd_fb.data(),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
}
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
@@ -275,7 +317,13 @@ public:
|
||||
if(! cont)
|
||||
{
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::post(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
net::post(std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(cont);
|
||||
}
|
||||
}
|
||||
@@ -300,7 +348,13 @@ public:
|
||||
if(! cont)
|
||||
{
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::post(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
net::post(std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(cont);
|
||||
}
|
||||
}
|
||||
@@ -358,10 +412,16 @@ public:
|
||||
// Fill the read buffer first, otherwise we
|
||||
// get fewer bytes at the cost of one I/O.
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
impl.stream().async_read_some(
|
||||
impl.rd_buf.prepare(read_size(
|
||||
impl.rd_buf, impl.rd_buf.max_size())),
|
||||
std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
impl.stream().async_read_some(
|
||||
impl.rd_buf.prepare(read_size(
|
||||
impl.rd_buf, impl.rd_buf.max_size())),
|
||||
std::move(*this));
|
||||
}
|
||||
impl.rd_buf.commit(bytes_transferred);
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
@@ -404,8 +464,14 @@ public:
|
||||
BOOST_ASSERT(buffer_bytes(buffers_prefix(
|
||||
clamp(impl.rd_remain), cb_)) > 0);
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
impl.stream().async_read_some(buffers_prefix(
|
||||
clamp(impl.rd_remain), cb_), std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
impl.stream().async_read_some(buffers_prefix(
|
||||
clamp(impl.rd_remain), cb_), std::move(*this));
|
||||
}
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
impl.reset_idle();
|
||||
@@ -448,10 +514,16 @@ public:
|
||||
{
|
||||
// read new
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
impl.stream().async_read_some(
|
||||
impl.rd_buf.prepare(read_size(
|
||||
impl.rd_buf, impl.rd_buf.max_size())),
|
||||
std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
impl.stream().async_read_some(
|
||||
impl.rd_buf.prepare(read_size(
|
||||
impl.rd_buf, impl.rd_buf.max_size())),
|
||||
std::move(*this));
|
||||
}
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
impl.reset_idle();
|
||||
@@ -548,10 +620,22 @@ public:
|
||||
if(! impl.wr_block.try_lock(this))
|
||||
{
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
impl.op_rd.emplace(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
impl.op_rd.emplace(std::move(*this));
|
||||
}
|
||||
impl.wr_block.lock(this);
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::post(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
net::post(std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
@@ -572,8 +656,14 @@ public:
|
||||
// Send close frame
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::async_write(impl.stream(), impl.rd_fb.data(),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read_some"));
|
||||
|
||||
net::async_write(impl.stream(), impl.rd_fb.data(),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
}
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
@@ -583,8 +673,14 @@ public:
|
||||
using beast::websocket::async_teardown;
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
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_read_some"));
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -677,6 +773,11 @@ public:
|
||||
ec, error::buffer_overflow);
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::async_read"));
|
||||
|
||||
read_some_op<read_op, mutable_buffers_type>(
|
||||
std::move(*this), sp, *mb);
|
||||
}
|
||||
|
@@ -420,6 +420,12 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
||||
{
|
||||
timer.expires_after(
|
||||
timeout_opt.handshake_timeout);
|
||||
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::check_stop_now"
|
||||
));
|
||||
|
||||
timer.async_wait(
|
||||
timeout_handler<Executor>(
|
||||
ex, this->weak_from_this()));
|
||||
@@ -436,6 +442,12 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
||||
else
|
||||
timer.expires_after(
|
||||
timeout_opt.idle_timeout);
|
||||
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::check_stop_now"
|
||||
));
|
||||
|
||||
timer.async_wait(
|
||||
timeout_handler<Executor>(
|
||||
ex, this->weak_from_this()));
|
||||
@@ -453,6 +465,12 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
||||
idle_counter = 0;
|
||||
timer.expires_after(
|
||||
timeout_opt.handshake_timeout);
|
||||
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::check_stop_now"
|
||||
));
|
||||
|
||||
timer.async_wait(
|
||||
timeout_handler<Executor>(
|
||||
ex, this->weak_from_this()));
|
||||
@@ -551,12 +569,26 @@ private:
|
||||
if( impl.timeout_opt.keep_alive_pings &&
|
||||
impl.idle_counter < 1)
|
||||
{
|
||||
idle_ping_op<Executor>(sp, get_executor());
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::timeout_handler"
|
||||
));
|
||||
|
||||
idle_ping_op<Executor>(sp, get_executor());
|
||||
}
|
||||
++impl.idle_counter;
|
||||
impl.timer.expires_after(
|
||||
impl.timeout_opt.idle_timeout / 2);
|
||||
impl.timer.async_wait(std::move(*this));
|
||||
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
"websocket::timeout_handler"
|
||||
));
|
||||
|
||||
impl.timer.async_wait(std::move(*this));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -174,10 +174,28 @@ operator()(
|
||||
{
|
||||
do_suspend:
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
impl.op_wr.emplace(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
fin_ ?
|
||||
"websocket::async_write" :
|
||||
"websocket::async_write_some"
|
||||
));
|
||||
|
||||
impl.op_wr.emplace(std::move(*this));
|
||||
}
|
||||
impl.wr_block.lock(this);
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::post(std::move(*this));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
fin_ ?
|
||||
"websocket::async_write" :
|
||||
"websocket::async_write_some"
|
||||
));
|
||||
|
||||
net::post(std::move(*this));
|
||||
}
|
||||
BOOST_ASSERT(impl.wr_block.is_locked(this));
|
||||
}
|
||||
if(impl.check_stop_now(ec))
|
||||
@@ -195,9 +213,18 @@ operator()(
|
||||
impl.wr_fb, fh_);
|
||||
impl.wr_cont = ! fin_;
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::async_write(impl.stream(),
|
||||
buffers_cat(impl.wr_fb.data(), cb_),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
fin_ ?
|
||||
"websocket::async_write" :
|
||||
"websocket::async_write_some"
|
||||
));
|
||||
|
||||
net::async_write(impl.stream(),
|
||||
buffers_cat(impl.wr_fb.data(), cb_),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
}
|
||||
bytes_transferred_ += clamp(fh_.len);
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
@@ -221,10 +248,19 @@ operator()(
|
||||
impl.wr_cont = ! fin_;
|
||||
// Send frame
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::async_write(impl.stream(), buffers_cat(
|
||||
impl.wr_fb.data(),
|
||||
buffers_prefix(clamp(fh_.len), cb_)),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
fin_ ?
|
||||
"websocket::async_write" :
|
||||
"websocket::async_write_some"
|
||||
));
|
||||
|
||||
net::async_write(impl.stream(), buffers_cat(
|
||||
impl.wr_fb.data(),
|
||||
buffers_prefix(clamp(fh_.len), cb_)),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
}
|
||||
n = clamp(fh_.len); // restore `n` on yield
|
||||
bytes_transferred_ += n;
|
||||
if(impl.check_stop_now(ec))
|
||||
@@ -272,10 +308,19 @@ operator()(
|
||||
impl.wr_cont = ! fin_;
|
||||
// write frame header and some payload
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::async_write(impl.stream(), buffers_cat(
|
||||
impl.wr_fb.data(),
|
||||
net::buffer(impl.wr_buf.get(), n)),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
fin_ ?
|
||||
"websocket::async_write" :
|
||||
"websocket::async_write_some"
|
||||
));
|
||||
|
||||
net::async_write(impl.stream(), buffers_cat(
|
||||
impl.wr_fb.data(),
|
||||
net::buffer(impl.wr_buf.get(), n)),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
}
|
||||
// VFALCO What about consuming the buffer on error?
|
||||
bytes_transferred_ +=
|
||||
bytes_transferred - impl.wr_fb.size();
|
||||
@@ -292,9 +337,18 @@ operator()(
|
||||
remain_ -= n;
|
||||
// write more payload
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::async_write(impl.stream(),
|
||||
net::buffer(impl.wr_buf.get(), n),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
fin_ ?
|
||||
"websocket::async_write" :
|
||||
"websocket::async_write_some"
|
||||
));
|
||||
|
||||
net::async_write(impl.stream(),
|
||||
net::buffer(impl.wr_buf.get(), n),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
}
|
||||
bytes_transferred_ += bytes_transferred;
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
@@ -325,10 +379,19 @@ operator()(
|
||||
impl.wr_cont = ! fin_;
|
||||
// Send frame
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::async_write(impl.stream(), buffers_cat(
|
||||
impl.wr_fb.data(),
|
||||
net::buffer(impl.wr_buf.get(), n)),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
fin_ ?
|
||||
"websocket::async_write" :
|
||||
"websocket::async_write_some"
|
||||
));
|
||||
|
||||
net::async_write(impl.stream(), buffers_cat(
|
||||
impl.wr_fb.data(),
|
||||
net::buffer(impl.wr_buf.get(), n)),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
}
|
||||
n = bytes_transferred - impl.wr_fb.size();
|
||||
bytes_transferred_ += n;
|
||||
if(impl.check_stop_now(ec))
|
||||
@@ -389,9 +452,18 @@ operator()(
|
||||
impl.wr_cont = ! fin_;
|
||||
// Send frame
|
||||
BOOST_ASIO_CORO_YIELD
|
||||
net::async_write(impl.stream(), buffers_cat(
|
||||
impl.wr_fb.data(), b),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
{
|
||||
BOOST_ASIO_HANDLER_LOCATION((
|
||||
__FILE__, __LINE__,
|
||||
fin_ ?
|
||||
"websocket::async_write" :
|
||||
"websocket::async_write_some"
|
||||
));
|
||||
|
||||
net::async_write(impl.stream(), buffers_cat(
|
||||
impl.wr_fb.data(), b),
|
||||
beast::detail::bind_continuation(std::move(*this)));
|
||||
}
|
||||
bytes_transferred_ += in_;
|
||||
if(impl.check_stop_now(ec))
|
||||
goto upcall;
|
||||
|
Reference in New Issue
Block a user