mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
basic_stream uses boost::shared_ptr
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Version 215:
|
||||||
|
|
||||||
|
* basic_stream uses boost::shared_ptr
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Version 214:
|
Version 214:
|
||||||
|
|
||||||
* Handler binders use the associated allocator
|
* Handler binders use the associated allocator
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
#include <boost/core/empty_value.hpp>
|
#include <boost/core/empty_value.hpp>
|
||||||
#include <boost/config/workaround.hpp>
|
#include <boost/config/workaround.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace asio {
|
namespace asio {
|
||||||
@ -200,7 +201,7 @@ class basic_stream
|
|||||||
public:
|
public:
|
||||||
#endif
|
#endif
|
||||||
struct impl_type
|
struct impl_type
|
||||||
: std::enable_shared_from_this<impl_type>
|
: boost::enable_shared_from_this<impl_type>
|
||||||
, boost::empty_value<Executor>
|
, boost::empty_value<Executor>
|
||||||
{
|
{
|
||||||
op_state read;
|
op_state read;
|
||||||
@ -227,7 +228,7 @@ public:
|
|||||||
Executor const&
|
Executor const&
|
||||||
ex() const noexcept
|
ex() const noexcept
|
||||||
{
|
{
|
||||||
return this->get();
|
return this->boost::empty_value<Executor>::get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset(); // set timeouts to never
|
void reset(); // set timeouts to never
|
||||||
@ -241,7 +242,7 @@ private:
|
|||||||
// outlive the destruction of the stream_socket object,
|
// outlive the destruction of the stream_socket object,
|
||||||
// in the case where there is no outstanding read or write
|
// in the case where there is no outstanding read or write
|
||||||
// but the implementation is still waiting on a timer.
|
// but the implementation is still waiting on a timer.
|
||||||
std::shared_ptr<impl_type> impl_;
|
boost::shared_ptr<impl_type> impl_;
|
||||||
|
|
||||||
// Restricted until P1322R0 is incorporated into Boost.Asio.
|
// Restricted until P1322R0 is incorporated into Boost.Asio.
|
||||||
static_assert(
|
static_assert(
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <boost/asio/bind_executor.hpp>
|
#include <boost/asio/bind_executor.hpp>
|
||||||
#include <boost/asio/coroutine.hpp>
|
#include <boost/asio/coroutine.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
#include <boost/make_shared.hpp>
|
||||||
#include <boost/core/exchange.hpp>
|
#include <boost/core/exchange.hpp>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@ -118,7 +119,7 @@ struct basic_stream<
|
|||||||
Protocol, Executor>::timeout_handler
|
Protocol, Executor>::timeout_handler
|
||||||
{
|
{
|
||||||
op_state& state;
|
op_state& state;
|
||||||
std::weak_ptr<impl_type> wp;
|
boost::weak_ptr<impl_type> wp;
|
||||||
tick_type tick;
|
tick_type tick;
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -163,7 +164,7 @@ class basic_stream<Protocol, Executor>::async_op
|
|||||||
: public async_op_base<Handler, Executor>
|
: public async_op_base<Handler, Executor>
|
||||||
, public boost::asio::coroutine
|
, public boost::asio::coroutine
|
||||||
{
|
{
|
||||||
std::shared_ptr<impl_type> impl_;
|
boost::shared_ptr<impl_type> impl_;
|
||||||
pending_guard pg_;
|
pending_guard pg_;
|
||||||
Buffers b_;
|
Buffers b_;
|
||||||
|
|
||||||
@ -292,7 +293,7 @@ class basic_stream_connect_op
|
|||||||
using timeout_handler =
|
using timeout_handler =
|
||||||
typename stream_type::timeout_handler;
|
typename stream_type::timeout_handler;
|
||||||
|
|
||||||
std::shared_ptr<typename
|
boost::shared_ptr<typename
|
||||||
stream_type::impl_type> impl_;
|
stream_type::impl_type> impl_;
|
||||||
typename stream_type::pending_guard pg0_;
|
typename stream_type::pending_guard pg0_;
|
||||||
typename stream_type::pending_guard pg1_;
|
typename stream_type::pending_guard pg1_;
|
||||||
@ -437,7 +438,7 @@ template<class Protocol, class Executor>
|
|||||||
template<class ExecutionContext, class... Args, class>
|
template<class ExecutionContext, class... Args, class>
|
||||||
basic_stream<Protocol, Executor>::
|
basic_stream<Protocol, Executor>::
|
||||||
basic_stream(ExecutionContext& ctx, Args&&... args)
|
basic_stream(ExecutionContext& ctx, Args&&... args)
|
||||||
: impl_(std::make_shared<impl_type>(
|
: impl_(boost::make_shared<impl_type>(
|
||||||
ctx.get_executor(),
|
ctx.get_executor(),
|
||||||
ctx, std::forward<Args>(args)...))
|
ctx, std::forward<Args>(args)...))
|
||||||
{
|
{
|
||||||
@ -452,7 +453,7 @@ template<class... Args>
|
|||||||
basic_stream<Protocol, Executor>::
|
basic_stream<Protocol, Executor>::
|
||||||
basic_stream(
|
basic_stream(
|
||||||
executor_type const& ex, Args&&... args)
|
executor_type const& ex, Args&&... args)
|
||||||
: impl_(std::make_shared<impl_type>(
|
: impl_(boost::make_shared<impl_type>(
|
||||||
ex,
|
ex,
|
||||||
ex.context(), std::forward<Args>(args)...))
|
ex.context(), std::forward<Args>(args)...))
|
||||||
{
|
{
|
||||||
@ -462,7 +463,7 @@ template<class Protocol, class Executor>
|
|||||||
template<class OtherProtocol, class>
|
template<class OtherProtocol, class>
|
||||||
basic_stream<Protocol, Executor>::
|
basic_stream<Protocol, Executor>::
|
||||||
basic_stream(net::basic_stream_socket<OtherProtocol>&& socket)
|
basic_stream(net::basic_stream_socket<OtherProtocol>&& socket)
|
||||||
: impl_(std::make_shared<impl_type>(
|
: impl_(boost::make_shared<impl_type>(
|
||||||
std::move(socket),
|
std::move(socket),
|
||||||
std::is_constructible<Executor,
|
std::is_constructible<Executor,
|
||||||
decltype(std::declval<net::basic_stream_socket<
|
decltype(std::declval<net::basic_stream_socket<
|
||||||
@ -473,7 +474,7 @@ basic_stream(net::basic_stream_socket<OtherProtocol>&& socket)
|
|||||||
template<class Protocol, class Executor>
|
template<class Protocol, class Executor>
|
||||||
basic_stream<Protocol, Executor>::
|
basic_stream<Protocol, Executor>::
|
||||||
basic_stream(basic_stream&& other)
|
basic_stream(basic_stream&& other)
|
||||||
: impl_(std::make_shared<impl_type>(
|
: impl_(boost::make_shared<impl_type>(
|
||||||
std::move(*other.impl_)))
|
std::move(*other.impl_)))
|
||||||
{
|
{
|
||||||
// VFALCO I'm not sure this implementation is correct...
|
// VFALCO I'm not sure this implementation is correct...
|
||||||
|
Reference in New Issue
Block a user