Fix completion handler invocation signatures

Completion handlers should be called with the exact same signature as
provided to `async_result`.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
Damian Jarek
2019-03-07 10:40:48 +01:00
committed by Vinnie Falco
parent fdf64a4550
commit b9aad3d06c
7 changed files with 38 additions and 18 deletions

View File

@ -2,6 +2,7 @@ Version 230:
* Don't use dynamic_buffer_ref
* Remove dynamic_buffer_ref
* Fix completion handler invocation signatures
--------------------------------------------------------------------------------

View File

@ -195,7 +195,7 @@ public:
std::forward<Handler_>(h),
sp->stream().get_executor())
, wp_(sp)
, res_(beast::allocate_stable<response_type>(*this,
, res_(beast::allocate_stable<response_type>(*this,
sp->build_response(req, decorator, result_)))
{
(*this)({}, 0, cont);
@ -209,8 +209,10 @@ public:
boost::ignore_unused(bytes_transferred);
auto sp = wp_.lock();
if(! sp)
return this->complete(cont,
net::error::operation_aborted);
{
ec = net::error::operation_aborted;
return this->complete(cont, ec);
}
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
{
@ -287,8 +289,10 @@ public:
boost::ignore_unused(bytes_transferred);
auto sp = wp_.lock();
if(! sp)
return this->complete(cont,
net::error::operation_aborted);
{
ec = net::error::operation_aborted;
return this->complete(cont, ec);
}
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
{
@ -306,7 +310,7 @@ public:
ec = error::closed;
if(impl.check_stop_now(ec))
goto upcall;
{
// Arguments from our state must be
// moved to the stack before releasing

View File

@ -75,8 +75,10 @@ public:
using beast::detail::clamp;
auto sp = wp_.lock();
if(! sp)
return this->complete(cont,
net::error::operation_aborted);
{
ec = net::error::operation_aborted;
return this->complete(cont, ec);
}
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
{

View File

@ -92,8 +92,10 @@ public:
boost::ignore_unused(bytes_used);
auto sp = wp_.lock();
if(! sp)
return this->complete(cont,
net::error::operation_aborted);
{
ec = net::error::operation_aborted;
return this->complete(cont, ec);
}
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
{

View File

@ -71,8 +71,10 @@ public:
boost::ignore_unused(bytes_transferred);
auto sp = wp_.lock();
if(! sp)
return this->complete(cont,
net::error::operation_aborted);
{
ec = net::error::operation_aborted;
return this->complete(cont, ec);
}
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
{

View File

@ -85,8 +85,11 @@ public:
using beast::detail::clamp;
auto sp = wp_.lock();
if(! sp)
return this->complete(cont,
net::error::operation_aborted, 0);
{
ec = net::error::operation_aborted;
bytes_written_ = 0;
return this->complete(cont, ec, bytes_written_);
}
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
{
@ -652,8 +655,11 @@ public:
using beast::detail::clamp;
auto sp = wp_.lock();
if(! sp)
return this->complete(cont,
net::error::operation_aborted, 0);
{
ec = net::error::operation_aborted;
bytes_written_ = 0;
return this->complete(cont, ec, bytes_written_);
}
auto& impl = *sp;
using mutable_buffers_type = typename
DynamicBuffer::mutable_buffers_type;

View File

@ -161,8 +161,11 @@ operator()(
net::mutable_buffer b;
auto sp = wp_.lock();
if(! sp)
return this->complete(cont,
net::error::operation_aborted, 0);
{
ec = net::error::operation_aborted;
bytes_transferred_ = 0;
return this->complete(cont, ec, bytes_transferred_);
}
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
{