Revert "Tidy up calls to post()"

This reverts commit 5eaa2be85e.
This commit is contained in:
Vinnie Falco
2018-03-22 20:13:39 -07:00
parent 4d660a5e54
commit 12cc10f8bb
11 changed files with 56 additions and 31 deletions

View File

@ -1,3 +1,9 @@
Version 167:
* Revert: Tidy up calls to post()
--------------------------------------------------------------------------------
Version 166: Version 166:
* Use boost::is_convertible as a workaround * Use boost::is_convertible as a workaround

View File

@ -413,6 +413,7 @@ operator()(boost::beast::error_code ec, std::size_t bytes_transferred)
// original handler. // original handler.
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post( boost::asio::post(
stream_.get_executor(),
beast::bind_handler(std::move(*this), ec, 0)); beast::bind_handler(std::move(*this), ec, 0));
} }
else else

View File

@ -121,6 +121,7 @@ read_some_op<MutableBufferSequence, Handler>::operator()(
} }
step_ = 3; step_ = 3;
return boost::asio::post( return boost::asio::post(
s_.get_executor(),
bind_handler(std::move(*this), ec, 0)); bind_handler(std::move(*this), ec, 0));
case 1: case 1:

View File

@ -170,11 +170,10 @@ operator()(
upcall: upcall:
if(! cont_) if(! cont_)
{ return boost::asio::post(
BOOST_ASIO_CORO_YIELD s_.get_executor(),
boost::asio::post( bind_handler(std::move(h_),
bind_handler(std::move(*this), ec)); ec, bytes_transferred_));
}
h_(ec, bytes_transferred_); h_(ec, bytes_transferred_);
} }
} }
@ -291,7 +290,7 @@ operator()(
if(Condition{}(p_)) if(Condition{}(p_))
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post( boost::asio::post(s_.get_executor(),
bind_handler(std::move(*this), ec)); bind_handler(std::move(*this), ec));
goto upcall; goto upcall;
} }

View File

@ -140,6 +140,7 @@ operator()()
{ {
BOOST_ASSERT(! f.invoked); BOOST_ASSERT(! f.invoked);
return boost::asio::post( return boost::asio::post(
s_.get_executor(),
bind_handler(std::move(*this), ec, 0)); bind_handler(std::move(*this), ec, 0));
} }
if(f.invoked) if(f.invoked)
@ -152,6 +153,7 @@ operator()()
BOOST_ASSERT(sr_.is_done()); BOOST_ASSERT(sr_.is_done());
} }
return boost::asio::post( return boost::asio::post(
s_.get_executor(),
bind_handler(std::move(*this), ec, 0)); bind_handler(std::move(*this), ec, 0));
} }
@ -282,6 +284,7 @@ operator()(
{ {
state_ = 1; state_ = 1;
return boost::asio::post( return boost::asio::post(
s_.get_executor(),
bind_handler(std::move(*this), ec, 0)); bind_handler(std::move(*this), ec, 0));
} }
state_ = 2; state_ = 2;

View File

@ -265,6 +265,7 @@ operator()(error_code ec, std::size_t)
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post( boost::asio::post(
d.ws.get_executor(),
bind_handler(std::move(*this), ec)); bind_handler(std::move(*this), ec));
} }
else else

View File

@ -152,7 +152,8 @@ operator()(
// Resume // Resume
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post(std::move(*this)); boost::asio::post(
d.ws.get_executor(), std::move(*this));
BOOST_ASSERT(d.ws.wr_block_.is_locked(this)); BOOST_ASSERT(d.ws.wr_block_.is_locked(this));
// Make sure the stream is open // Make sure the stream is open
@ -195,7 +196,8 @@ operator()(
// Resume // Resume
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post(std::move(*this)); boost::asio::post(
d.ws.get_executor(), std::move(*this));
BOOST_ASSERT(d.ws.rd_block_.is_locked(this)); BOOST_ASSERT(d.ws.rd_block_.is_locked(this));
// Make sure the stream is open // Make sure the stream is open
@ -301,9 +303,10 @@ operator()(
d.ws.paused_wr_.maybe_invoke(); d.ws.paused_wr_.maybe_invoke();
if(! d.cont) if(! d.cont)
{ {
BOOST_ASIO_CORO_YIELD auto& ws = d.ws;
boost::asio::post( return boost::asio::post(
bind_handler(std::move(*this), ec)); ws.stream_.get_executor(),
bind_handler(d_.release_handler(), ec));
} }
d_.invoke(ec); d_.invoke(ec);
} }

View File

@ -135,6 +135,7 @@ operator()(error_code ec, std::size_t)
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post( boost::asio::post(
d.ws.get_executor(),
bind_handler(std::move(*this), ec)); bind_handler(std::move(*this), ec));
goto upcall; goto upcall;
} }
@ -150,7 +151,8 @@ operator()(error_code ec, std::size_t)
// Resume // Resume
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post(std::move(*this)); boost::asio::post(
d.ws.get_executor(), std::move(*this));
BOOST_ASSERT(d.ws.wr_block_.is_locked(this)); BOOST_ASSERT(d.ws.wr_block_.is_locked(this));
// Make sure the stream is open // Make sure the stream is open

View File

@ -196,7 +196,8 @@ operator()(
// Resume // Resume
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post(std::move(*this)); boost::asio::post(
ws_.get_executor(), std::move(*this));
BOOST_ASSERT(ws_.rd_block_.is_locked(this)); BOOST_ASSERT(ws_.rd_block_.is_locked(this));
// The only way to get read blocked is if // The only way to get read blocked is if
@ -277,7 +278,9 @@ operator()(
if(! cont_) if(! cont_)
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post(std::move(*this)); boost::asio::post(
ws_.get_executor(),
std::move(*this));
BOOST_ASSERT(cont_); BOOST_ASSERT(cont_);
} }
} }
@ -319,7 +322,8 @@ operator()(
// Resume // Resume
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post(std::move(*this)); boost::asio::post(
ws_.get_executor(), std::move(*this));
BOOST_ASSERT(ws_.wr_block_.is_locked(this)); BOOST_ASSERT(ws_.wr_block_.is_locked(this));
// Make sure the stream is open // Make sure the stream is open
@ -350,7 +354,9 @@ operator()(
if(! cont_) if(! cont_)
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post(std::move(*this)); boost::asio::post(
ws_.get_executor(),
std::move(*this));
BOOST_ASSERT(cont_); BOOST_ASSERT(cont_);
} }
} }
@ -374,7 +380,9 @@ operator()(
if(! cont_) if(! cont_)
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post(std::move(*this)); boost::asio::post(
ws_.get_executor(),
std::move(*this));
BOOST_ASSERT(cont_); BOOST_ASSERT(cont_);
} }
} }
@ -630,7 +638,8 @@ operator()(
// Resume // Resume
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post(std::move(*this)); boost::asio::post(
ws_.get_executor(), std::move(*this));
BOOST_ASSERT(ws_.wr_block_.is_locked(this)); BOOST_ASSERT(ws_.wr_block_.is_locked(this));
// Make sure the stream is open // Make sure the stream is open
@ -691,11 +700,10 @@ operator()(
ws_.paused_ping_.maybe_invoke() || ws_.paused_ping_.maybe_invoke() ||
ws_.paused_wr_.maybe_invoke(); ws_.paused_wr_.maybe_invoke();
if(! cont_) if(! cont_)
{ return boost::asio::post(
BOOST_ASIO_CORO_YIELD ws_.stream_.get_executor(),
boost::asio::post( bind_handler(std::move(h_),
bind_handler(std::move(*this), ec)); ec, bytes_written_));
}
h_(ec, bytes_written_); h_(ec, bytes_written_);
} }
} }
@ -806,8 +814,9 @@ operator()(
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post( boost::asio::post(
ws_.get_executor(),
bind_handler(std::move(*this), bind_handler(std::move(*this),
error::buffer_overflow)); error::buffer_overflow, 0));
break; break;
} }
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD

View File

@ -113,7 +113,8 @@ operator()(error_code ec, std::size_t bytes_transferred)
{ {
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post( boost::asio::post(
bind_handler(std::move(*this), ec)); s_.get_executor(),
bind_handler(std::move(*this), ec, 0));
goto upcall; goto upcall;
} }
for(;;) for(;;)

View File

@ -321,7 +321,8 @@ operator()(
// Resume // Resume
BOOST_ASIO_CORO_YIELD BOOST_ASIO_CORO_YIELD
boost::asio::post(std::move(*this)); boost::asio::post(
ws_.get_executor(), std::move(*this));
BOOST_ASSERT(ws_.wr_block_.is_locked(this)); BOOST_ASSERT(ws_.wr_block_.is_locked(this));
// Make sure the stream is open // Make sure the stream is open
@ -568,11 +569,9 @@ operator()(
ws_.paused_rd_.maybe_invoke() || ws_.paused_rd_.maybe_invoke() ||
ws_.paused_ping_.maybe_invoke(); ws_.paused_ping_.maybe_invoke();
if(! cont_) if(! cont_)
{ return boost::asio::post(
BOOST_ASIO_CORO_YIELD ws_.stream_.get_executor(),
boost::asio::post( bind_handler(std::move(h_), ec, bytes_transferred_));
bind_handler(std::move(*this), ec));
}
h_(ec, bytes_transferred_); h_(ec, bytes_transferred_);
} }
} }