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