Add handler tracking locations to http operations

This commit is contained in:
Christopher Kohlhoff
2020-08-15 23:30:04 +10:00
committed by Richard Hodges
parent 5641d9498b
commit 11385141ea
3 changed files with 62 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
Version XXX: Version XXX:
* Add handler tracking locations to basic_stream. * Add handler tracking locations to basic_stream.
* Add handler tracking locations to http operations.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -97,6 +97,10 @@ public:
, d_(beast::allocate_stable<data>( , d_(beast::allocate_stable<data>(
*this, s, m)) *this, s, m))
{ {
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"http::async_read(msg)"));
http::async_read(d_.s, b, d_.p, std::move(*this)); http::async_read(d_.s, b, d_.p, std::move(*this));
} }
@@ -203,6 +207,11 @@ public:
b_, size, ec, error::buffer_overflow); b_, size, ec, error::buffer_overflow);
if(ec) if(ec)
goto upcall; goto upcall;
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"http::async_read_some"));
s_.async_read_some(*mb, std::move(self)); s_.async_read_some(*mb, std::move(self));
} }
b_.commit(bytes_transferred); b_.commit(bytes_transferred);
@@ -230,8 +239,14 @@ public:
if(! cont_) if(! cont_)
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"http::async_read_some"));
net::post( net::post(
beast::bind_front_handler(std::move(self), ec)); beast::bind_front_handler(std::move(self), ec));
}
} }
self.complete(ec, bytes_transferred_); self.complete(ec, bytes_transferred_);
} }
@@ -264,15 +279,27 @@ public:
if (Condition{}(p_)) if (Condition{}(p_))
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"http::async_read"));
net::post(std::move(self)); net::post(std::move(self));
}
} }
else else
{ {
do do
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"http::async_read"));
async_read_some( async_read_some(
s_, b_, p_, std::move(self)); s_, b_, p_, std::move(self));
}
bytes_transferred_ += bytes_transferred; bytes_transferred_ += bytes_transferred;
} while (!ec && } while (!ec &&
!Condition{}(p_)); !Condition{}(p_));

View File

@@ -60,6 +60,10 @@ class write_some_op
error_code& ec, error_code& ec,
ConstBufferSequence const& buffers) ConstBufferSequence const& buffers)
{ {
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"http::async_write_some"));
invoked = true; invoked = true;
ec = {}; ec = {};
op_.s_.async_write_some( op_.s_.async_write_some(
@@ -93,6 +97,11 @@ public:
if(ec) if(ec)
{ {
BOOST_ASSERT(! f.invoked); BOOST_ASSERT(! f.invoked);
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"http::async_write_some"));
return net::post( return net::post(
s_.get_executor(), s_.get_executor(),
beast::bind_front_handler( beast::bind_front_handler(
@@ -107,6 +116,10 @@ public:
BOOST_ASSERT(sr_.is_done()); BOOST_ASSERT(sr_.is_done());
} }
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"http::async_write_some"));
return net::post( return net::post(
s_.get_executor(), s_.get_executor(),
beast::bind_front_handler( beast::bind_front_handler(
@@ -191,16 +204,28 @@ public:
if(Predicate{}(sr_)) if(Predicate{}(sr_))
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
net::post( {
s_.get_executor(), BOOST_ASIO_HANDLER_LOCATION((
std::move(*this)); __FILE__, __LINE__,
"http::async_write"));
net::post(
s_.get_executor(),
std::move(*this));
}
goto upcall; goto upcall;
} }
for(;;) for(;;)
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
beast::http::async_write_some( {
s_, sr_, std::move(*this)); BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"http::async_write"));
beast::http::async_write_some(
s_, sr_, std::move(*this));
}
bytes_transferred_ += bytes_transferred; bytes_transferred_ += bytes_transferred;
if(ec) if(ec)
goto upcall; goto upcall;
@@ -248,6 +273,10 @@ public:
void void
operator()() operator()()
{ {
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__,
"http::async_write(msg)"));
async_write(s_, sr_, std::move(*this)); async_write(s_, sr_, std::move(*this));
} }