handler_ptr is deprecated (API Change):

* `handler_ptr` is deprecated and should not be used.

Actions Required:

* Replace use of `handler_ptr` with `stable_async_base`
  and `allocate_stable`.
This commit is contained in:
Vinnie Falco
2019-03-06 10:38:08 -08:00
parent 7f53b0f66c
commit 45353a7f04
27 changed files with 95 additions and 64 deletions
@@ -293,7 +293,7 @@ public:
}
}
upcall:
this->invoke_now(ec, bytes_transferred);
this->complete_now(ec, bytes_transferred);
}
}
};
-1
View File
@@ -34,7 +34,6 @@
#include <boost/beast/core/flat_buffer.hpp>
#include <boost/beast/core/flat_static_buffer.hpp>
#include <boost/beast/core/flat_stream.hpp>
#include <boost/beast/core/handler_ptr.hpp>
#include <boost/beast/core/make_printable.hpp>
#include <boost/beast/core/multi_buffer.hpp>
#include <boost/beast/core/ostream.hpp>
+6 -6
View File
@@ -317,7 +317,7 @@ public:
This invokes the final completion handler with the specified
arguments forwarded. It is undefined to call either of
@ref invoke or @ref invoke_now more than once.
@ref complete or @ref complete_now more than once.
Any temporary objects allocated with @ref beast::allocate_stable will
be automatically destroyed before the final completion handler
@@ -326,7 +326,7 @@ public:
@param is_continuation If this value is `false`, then the
handler will be submitted to the executor using `net::post`.
Otherwise the handler will be invoked as if by calling
@ref invoke_now.
@ref complete_now.
@param args A list of optional parameters to invoke the handler
with. The completion handler must be invocable with the parameter
@@ -334,7 +334,7 @@ public:
*/
template<class... Args>
void
invoke(bool is_continuation, Args&&... args)
complete(bool is_continuation, Args&&... args)
{
this->before_invoke_hook();
if(! is_continuation)
@@ -357,7 +357,7 @@ public:
This invokes the final completion handler with the specified
arguments forwarded. It is undefined to call either of
@ref invoke or @ref invoke_now more than once.
@ref complete or @ref complete_now more than once.
Any temporary objects allocated with @ref beast::allocate_stable will
be automatically destroyed before the final completion handler
@@ -369,7 +369,7 @@ public:
*/
template<class... Args>
void
invoke_now(Args&&... args)
complete_now(Args&&... args)
{
this->before_invoke_hook();
wg1_.reset();
@@ -532,7 +532,7 @@ public:
}
// The base class destroys the temporary data automatically, before invoking the final completion handler
this->invoke_now(ec);
this->complete_now(ec);
}
};
@@ -103,7 +103,7 @@ public:
b_.prepare(0), std::move(*this));
ec = ec_;
}
this->invoke_now(ec, total_);
this->complete_now(ec, total_);
}
}
};
+1 -1
View File
@@ -626,7 +626,7 @@ operator()(error_code ec, std::size_t bytes_transferred, bool cont)
// At this point, we are guaranteed that the original initiating
// function is no longer on our stack frame.
this->invoke_now(ec, static_cast<bool>(result_));
this->complete_now(ec, static_cast<bool>(result_));
}
}
+12
View File
@@ -13,9 +13,14 @@
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/detail/allocator.hpp>
#include <boost/assert.hpp>
#include <boost/config/pragma_message.hpp>
#include <type_traits>
#include <utility>
#ifndef BOOST_BEAST_DOXYGEN
BOOST_PRAGMA_MESSAGE("<boost/beast/core/handler_ptr.hpp> is DEPRECATED and will be removed in a future release.")
namespace boost {
namespace beast {
@@ -49,6 +54,11 @@ namespace beast {
template<class T, class Handler>
class handler_ptr
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(T) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
T* t_ = nullptr;
union
{
@@ -215,3 +225,5 @@ public:
#include <boost/beast/core/impl/handler_ptr.hpp>
#endif
#endif
@@ -397,7 +397,7 @@ public:
upcall:
pg_.reset();
transfer_bytes(bytes_transferred);
this->invoke_now(ec, bytes_transferred);
this->complete_now(ec, bytes_transferred);
}
}
};
@@ -528,7 +528,7 @@ public:
pg0_.reset();
pg1_.reset();
this->invoke_now(ec, std::forward<Args>(args)...);
this->complete_now(ec, std::forward<Args>(args)...);
}
};
@@ -99,7 +99,7 @@ public:
s_.buffer_.consume(bytes_transferred);
break;
}
this->invoke_now(ec, bytes_transferred);
this->complete_now(ec, bytes_transferred);
}
};
@@ -71,7 +71,7 @@ public:
boost::system::error_code ec,
std::size_t bytes_transferred)
{
this->invoke_now(ec, bytes_transferred);
this->complete_now(ec, bytes_transferred);
}
};
+3 -4
View File
@@ -12,14 +12,13 @@
#ifndef BOOST_BEAST_DOXYGEN
BOOST_PRAGMA_MESSAGE("<boost/beast/core/type_traits.hpp> is DEPRECATED and will be removed in a future release.")
#include <boost/beast/core/file_base.hpp>
#include <boost/beast/core/stream_traits.hpp>
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/detail/is_invocable.hpp>
#include <boost/config/pragma_message.hpp>
#include <type_traits.hpp>
BOOST_PRAGMA_MESSAGE("<boost/beast/core/type_traits.hpp> is DEPRECATED and will be removed in a future release.")
namespace boost {
namespace beast {
@@ -430,7 +430,7 @@ public:
BOOST_ASSERT(sr_.is_done());
}
}
this->invoke_now(ec, bytes_transferred_);
this->complete_now(ec, bytes_transferred_);
}
};
+1 -1
View File
@@ -209,7 +209,7 @@ public:
{
if(! ec)
d_.m = d_.p.release();
this->invoke_now(ec, bytes_transferred);
this->complete_now(ec, bytes_transferred);
}
};
+3 -3
View File
@@ -119,7 +119,7 @@ public:
{
if(! ec)
sr_.consume(bytes_transferred);
this->invoke_now(ec, bytes_transferred);
this->complete_now(ec, bytes_transferred);
}
};
@@ -207,7 +207,7 @@ public:
break;
}
upcall:
this->invoke_now(ec, bytes_transferred_);
this->complete_now(ec, bytes_transferred_);
}
}
};
@@ -254,7 +254,7 @@ public:
operator()(
error_code ec, std::size_t bytes_transferred)
{
this->invoke_now(ec, bytes_transferred);
this->complete_now(ec, bytes_transferred);
}
};
+10 -10
View File
@@ -209,7 +209,7 @@ public:
boost::ignore_unused(bytes_transferred);
auto sp = wp_.lock();
if(! sp)
return this->invoke(cont,
return this->complete(cont,
net::error::operation_aborted);
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
@@ -231,7 +231,7 @@ public:
impl.open(role_type::server);
}
upcall:
this->invoke(cont, ec);
this->complete(cont, ec);
}
}
};
@@ -287,7 +287,7 @@ public:
boost::ignore_unused(bytes_transferred);
auto sp = wp_.lock();
if(! sp)
return this->invoke(cont,
return this->complete(cont,
net::error::operation_aborted);
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
@@ -320,7 +320,7 @@ public:
}
upcall:
this->invoke(cont, ec);
this->complete(cont, ec);
}
}
};
@@ -709,7 +709,7 @@ void
stream<NextLayer, deflateSupported>::
accept_ex(ResponseDecorator const& decorator)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
@@ -730,7 +730,7 @@ void
stream<NextLayer, deflateSupported>::
accept_ex(ResponseDecorator const& decorator, error_code& ec)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
@@ -755,7 +755,7 @@ accept_ex(
ConstBufferSequence const& buffers,
ResponseDecorator const &decorator)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
@@ -785,7 +785,7 @@ accept_ex(
ResponseDecorator const& decorator,
error_code& ec)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
@@ -811,7 +811,7 @@ accept_ex(
http::basic_fields<Allocator>> const& req,
ResponseDecorator const& decorator)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
@@ -838,7 +838,7 @@ accept_ex(
ResponseDecorator const& decorator,
error_code& ec)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
+2 -2
View File
@@ -75,7 +75,7 @@ public:
using beast::detail::clamp;
auto sp = wp_.lock();
if(! sp)
return this->invoke(cont,
return this->complete(cont,
net::error::operation_aborted);
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
@@ -225,7 +225,7 @@ public:
|| impl.op_idle_ping.maybe_invoke()
|| impl.op_ping.maybe_invoke()
|| impl.op_wr.maybe_invoke();
this->invoke(cont, ec);
this->complete(cont, ec);
}
}
};
@@ -92,7 +92,7 @@ public:
boost::ignore_unused(bytes_used);
auto sp = wp_.lock();
if(! sp)
return this->invoke(cont,
return this->complete(cont,
net::error::operation_aborted);
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
@@ -159,7 +159,7 @@ public:
swap(d_.p.get(), *res_p_);
upcall:
this->invoke(cont ,ec);
this->complete(cont ,ec);
}
}
};
@@ -382,7 +382,7 @@ handshake_ex(string_view host,
string_view target,
RequestDecorator const& decorator)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
@@ -406,7 +406,7 @@ handshake_ex(response_type& res,
string_view target,
RequestDecorator const& decorator)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
@@ -430,7 +430,7 @@ handshake_ex(string_view host,
RequestDecorator const& decorator,
error_code& ec)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
@@ -453,7 +453,7 @@ handshake_ex(response_type& res,
RequestDecorator const& decorator,
error_code& ec)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
@@ -475,7 +475,7 @@ async_handshake_ex(string_view host,
RequestDecorator const& decorator,
HandshakeHandler&& handler)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
@@ -508,7 +508,7 @@ async_handshake_ex(response_type& res,
RequestDecorator const& decorator,
HandshakeHandler&& handler)
{
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
+2 -2
View File
@@ -71,7 +71,7 @@ public:
boost::ignore_unused(bytes_transferred);
auto sp = wp_.lock();
if(! sp)
return this->invoke(cont,
return this->complete(cont,
net::error::operation_aborted);
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
@@ -102,7 +102,7 @@ public:
|| impl.op_idle_ping.maybe_invoke()
|| impl.op_rd.maybe_invoke()
|| impl.op_wr.maybe_invoke();
this->invoke(cont, ec);
this->complete(cont, ec);
}
}
};
+4 -4
View File
@@ -85,7 +85,7 @@ public:
using beast::detail::clamp;
auto sp = wp_.lock();
if(! sp)
return this->invoke(cont,
return this->complete(cont,
net::error::operation_aborted, 0);
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
@@ -603,7 +603,7 @@ public:
|| impl.op_idle_ping.maybe_invoke()
|| impl.op_ping.maybe_invoke()
|| impl.op_wr.maybe_invoke();
this->invoke(cont, ec, bytes_written_);
this->complete(cont, ec, bytes_written_);
}
}
};
@@ -652,7 +652,7 @@ public:
using beast::detail::clamp;
auto sp = wp_.lock();
if(! sp)
return this->invoke(cont,
return this->complete(cont,
net::error::operation_aborted, 0);
auto& impl = *sp;
using mutable_buffers_type = typename
@@ -680,7 +680,7 @@ public:
while(! some_ && ! impl.rd_done);
upcall:
this->invoke(cont, ec, bytes_written_);
this->complete(cont, ec, bytes_written_);
}
}
};
@@ -120,7 +120,7 @@ public:
error_code ignored;
s_.non_blocking(nb_, ignored);
}
this->invoke_now(ec);
this->complete_now(ec);
}
}
};
+2 -2
View File
@@ -161,7 +161,7 @@ operator()(
net::mutable_buffer b;
auto sp = wp_.lock();
if(! sp)
return this->invoke(cont,
return this->complete(cont,
net::error::operation_aborted, 0);
auto& impl = *sp;
BOOST_ASIO_CORO_REENTER(*this)
@@ -426,7 +426,7 @@ operator()(
|| impl.op_idle_ping.maybe_invoke()
|| impl.op_rd.maybe_invoke()
|| impl.op_ping.maybe_invoke();
this->invoke(cont, ec, bytes_transferred_);
this->complete(cont, ec, bytes_transferred_);
}
}
+1 -1
View File
@@ -12,7 +12,7 @@
#include <boost/beast/core/detail/config.hpp>
#if ! BOOST_BEAST_ALLOW_DEPRECATED
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
#error This file is deprecated interface, #define BOOST_BEAST_ALLOW_DEPRECATED to allow it