update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -2,7 +2,7 @@
// ssl/detail/buffered_handshake_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -30,6 +30,11 @@ template <typename ConstBufferSequence>
class buffered_handshake_op
{
public:
static BOOST_ASIO_CONSTEXPR const char* tracking_name()
{
return "ssl::stream<>::async_buffered_handshake";
}
buffered_handshake_op(stream_base::handshake_type type,
const ConstBufferSequence& buffers)
: type_(type),
@@ -52,7 +57,7 @@ public:
const boost::system::error_code& ec,
const std::size_t& bytes_transferred) const
{
handler(ec, bytes_transferred);
BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler)(ec, bytes_transferred);
}
private:

View File

@@ -2,7 +2,7 @@
// ssl/detail/engine.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -59,9 +59,22 @@ public:
// Construct a new engine for the specified context.
BOOST_ASIO_DECL explicit engine(SSL_CTX* context);
// Construct a new engine for an existing native SSL implementation.
BOOST_ASIO_DECL explicit engine(SSL* ssl_impl);
#if defined(BOOST_ASIO_HAS_MOVE)
// Move construct from another engine.
BOOST_ASIO_DECL engine(engine&& other) BOOST_ASIO_NOEXCEPT;
#endif // defined(BOOST_ASIO_HAS_MOVE)
// Destructor.
BOOST_ASIO_DECL ~engine();
#if defined(BOOST_ASIO_HAS_MOVE)
// Move assign from another engine.
BOOST_ASIO_DECL engine& operator=(engine&& other) BOOST_ASIO_NOEXCEPT;
#endif // defined(BOOST_ASIO_HAS_MOVE)
// Get the underlying implementation in the native type.
BOOST_ASIO_DECL SSL* native_handle();

View File

@@ -2,7 +2,7 @@
// ssl/detail/handshake_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -29,6 +29,11 @@ namespace detail {
class handshake_op
{
public:
static BOOST_ASIO_CONSTEXPR const char* tracking_name()
{
return "ssl::stream<>::async_handshake";
}
handshake_op(stream_base::handshake_type type)
: type_(type)
{
@@ -47,7 +52,7 @@ public:
const boost::system::error_code& ec,
const std::size_t&) const
{
handler(ec);
BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler)(ec);
}
private:

View File

@@ -2,7 +2,7 @@
// ssl/detail/impl/engine.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -56,18 +56,63 @@ engine::engine(SSL_CTX* context)
::SSL_set_bio(ssl_, int_bio, int_bio);
}
engine::engine(SSL* ssl_impl)
: ssl_(ssl_impl)
{
#if (OPENSSL_VERSION_NUMBER < 0x10000000L)
accept_mutex().init();
#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L)
::SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE);
::SSL_set_mode(ssl_, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
#if defined(SSL_MODE_RELEASE_BUFFERS)
::SSL_set_mode(ssl_, SSL_MODE_RELEASE_BUFFERS);
#endif // defined(SSL_MODE_RELEASE_BUFFERS)
::BIO* int_bio = 0;
::BIO_new_bio_pair(&int_bio, 0, &ext_bio_, 0);
::SSL_set_bio(ssl_, int_bio, int_bio);
}
#if defined(BOOST_ASIO_HAS_MOVE)
engine::engine(engine&& other) BOOST_ASIO_NOEXCEPT
: ssl_(other.ssl_),
ext_bio_(other.ext_bio_)
{
other.ssl_ = 0;
other.ext_bio_ = 0;
}
#endif // defined(BOOST_ASIO_HAS_MOVE)
engine::~engine()
{
if (SSL_get_app_data(ssl_))
if (ssl_ && SSL_get_app_data(ssl_))
{
delete static_cast<verify_callback_base*>(SSL_get_app_data(ssl_));
SSL_set_app_data(ssl_, 0);
}
::BIO_free(ext_bio_);
::SSL_free(ssl_);
if (ext_bio_)
::BIO_free(ext_bio_);
if (ssl_)
::SSL_free(ssl_);
}
#if defined(BOOST_ASIO_HAS_MOVE)
engine& engine::operator=(engine&& other) BOOST_ASIO_NOEXCEPT
{
if (this != &other)
{
ssl_ = other.ssl_;
ext_bio_ = other.ext_bio_;
other.ssl_ = 0;
other.ext_bio_ = 0;
}
return *this;
}
#endif // defined(BOOST_ASIO_HAS_MOVE)
SSL* engine::native_handle()
{
return ssl_;

View File

@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
// Copyright (c) 2005-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2005-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -86,9 +86,13 @@ public:
#endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L)
// && (OPENSSL_VERSION_NUMBER < 0x10100000L)
// && !defined(SSL_OP_NO_COMPRESSION)
#if !defined(OPENSSL_IS_BORINGSSL)
#if !defined(OPENSSL_IS_BORINGSSL) \
&& !defined(BOOST_ASIO_USE_WOLFSSL) \
&& (OPENSSL_VERSION_NUMBER < 0x30000000L)
::CONF_modules_unload(1);
#endif // !defined(OPENSSL_IS_BORINGSSL)
// && !defined(BOOST_ASIO_USE_WOLFSSL)
// && (OPENSSL_VERSION_NUMBER < 0x30000000L)
#if !defined(OPENSSL_NO_ENGINE) \
&& (OPENSSL_VERSION_NUMBER < 0x10100000L)
::ENGINE_cleanup();

View File

@@ -2,7 +2,7 @@
// ssl/detail/io.hpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -17,6 +17,8 @@
#include <boost/asio/detail/config.hpp>
#include <boost/asio/detail/base_from_cancellation_state.hpp>
#include <boost/asio/detail/handler_tracking.hpp>
#include <boost/asio/ssl/detail/engine.hpp>
#include <boost/asio/ssl/detail/stream_core.hpp>
#include <boost/asio/write.hpp>
@@ -94,11 +96,13 @@ std::size_t io(Stream& next_layer, stream_core& core,
template <typename Stream, typename Operation, typename Handler>
class io_op
: public boost::asio::detail::base_from_cancellation_state<Handler>
{
public:
io_op(Stream& next_layer, stream_core& core,
const Operation& op, Handler& handler)
: next_layer_(next_layer),
: boost::asio::detail::base_from_cancellation_state<Handler>(handler),
next_layer_(next_layer),
core_(core),
op_(op),
start_(0),
@@ -110,7 +114,8 @@ public:
#if defined(BOOST_ASIO_HAS_MOVE)
io_op(const io_op& other)
: next_layer_(other.next_layer_),
: boost::asio::detail::base_from_cancellation_state<Handler>(other),
next_layer_(other.next_layer_),
core_(other.core_),
op_(other.op_),
start_(other.start_),
@@ -122,7 +127,11 @@ public:
}
io_op(io_op&& other)
: next_layer_(other.next_layer_),
: boost::asio::detail::base_from_cancellation_state<Handler>(
BOOST_ASIO_MOVE_CAST(
boost::asio::detail::base_from_cancellation_state<Handler>)(
other)),
next_layer_(other.next_layer_),
core_(other.core_),
op_(BOOST_ASIO_MOVE_CAST(Operation)(other.op_)),
start_(other.start_),
@@ -163,6 +172,9 @@ public:
// Prevent other read operations from being started.
core_.pending_read_.expires_at(core_.pos_infin());
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__, Operation::tracking_name()));
// Start reading some data from the underlying transport.
next_layer_.async_read_some(
boost::asio::buffer(core_.input_buffer_),
@@ -170,6 +182,9 @@ public:
}
else
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__, Operation::tracking_name()));
// Wait until the current read operation completes.
core_.pending_read_.async_wait(BOOST_ASIO_MOVE_CAST(io_op)(*this));
}
@@ -190,6 +205,9 @@ public:
// Prevent other write operations from being started.
core_.pending_write_.expires_at(core_.pos_infin());
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__, Operation::tracking_name()));
// Start writing all the data to the underlying transport.
boost::asio::async_write(next_layer_,
core_.engine_.get_output(core_.output_buffer_),
@@ -197,6 +215,9 @@ public:
}
else
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__, Operation::tracking_name()));
// Wait until the current write operation completes.
core_.pending_write_.async_wait(BOOST_ASIO_MOVE_CAST(io_op)(*this));
}
@@ -214,6 +235,9 @@ public:
// read so the handler runs "as-if" posted using io_context::post().
if (start)
{
BOOST_ASIO_HANDLER_LOCATION((
__FILE__, __LINE__, Operation::tracking_name()));
next_layer_.async_read_some(
boost::asio::buffer(core_.input_buffer_, 0),
BOOST_ASIO_MOVE_CAST(io_op)(*this));
@@ -247,6 +271,13 @@ public:
// Release any waiting read operations.
core_.pending_read_.expires_at(core_.neg_infin());
// Check for cancellation before continuing.
if (this->cancelled() != cancellation_type::none)
{
ec_ = boost::asio::error::operation_aborted;
break;
}
// Try the operation again.
continue;
@@ -255,6 +286,13 @@ public:
// Release any waiting write operations.
core_.pending_write_.expires_at(core_.neg_infin());
// Check for cancellation before continuing.
if (this->cancelled() != cancellation_type::none)
{
ec_ = boost::asio::error::operation_aborted;
break;
}
// Try the operation again.
continue;
@@ -294,19 +332,29 @@ public:
};
template <typename Stream, typename Operation, typename Handler>
inline void* asio_handler_allocate(std::size_t size,
inline asio_handler_allocate_is_deprecated
asio_handler_allocate(std::size_t size,
io_op<Stream, Operation, Handler>* this_handler)
{
#if defined(BOOST_ASIO_NO_DEPRECATED)
boost_asio_handler_alloc_helpers::allocate(size, this_handler->handler_);
return asio_handler_allocate_is_no_longer_used();
#else // defined(BOOST_ASIO_NO_DEPRECATED)
return boost_asio_handler_alloc_helpers::allocate(
size, this_handler->handler_);
#endif // defined(BOOST_ASIO_NO_DEPRECATED)
}
template <typename Stream, typename Operation, typename Handler>
inline void asio_handler_deallocate(void* pointer, std::size_t size,
inline asio_handler_deallocate_is_deprecated
asio_handler_deallocate(void* pointer, std::size_t size,
io_op<Stream, Operation, Handler>* this_handler)
{
boost_asio_handler_alloc_helpers::deallocate(
pointer, size, this_handler->handler_);
#if defined(BOOST_ASIO_NO_DEPRECATED)
return asio_handler_deallocate_is_no_longer_used();
#endif // defined(BOOST_ASIO_NO_DEPRECATED)
}
template <typename Stream, typename Operation, typename Handler>
@@ -319,20 +367,28 @@ inline bool asio_handler_is_continuation(
template <typename Function, typename Stream,
typename Operation, typename Handler>
inline void asio_handler_invoke(Function& function,
inline asio_handler_invoke_is_deprecated
asio_handler_invoke(Function& function,
io_op<Stream, Operation, Handler>* this_handler)
{
boost_asio_handler_invoke_helpers::invoke(
function, this_handler->handler_);
#if defined(BOOST_ASIO_NO_DEPRECATED)
return asio_handler_invoke_is_no_longer_used();
#endif // defined(BOOST_ASIO_NO_DEPRECATED)
}
template <typename Function, typename Stream,
typename Operation, typename Handler>
inline void asio_handler_invoke(const Function& function,
inline asio_handler_invoke_is_deprecated
asio_handler_invoke(const Function& function,
io_op<Stream, Operation, Handler>* this_handler)
{
boost_asio_handler_invoke_helpers::invoke(
function, this_handler->handler_);
#if defined(BOOST_ASIO_NO_DEPRECATED)
return asio_handler_invoke_is_no_longer_used();
#endif // defined(BOOST_ASIO_NO_DEPRECATED)
}
template <typename Stream, typename Operation, typename Handler>
@@ -347,31 +403,29 @@ inline void async_io(Stream& next_layer, stream_core& core,
} // namespace detail
} // namespace ssl
template <typename Stream, typename Operation,
typename Handler, typename Allocator>
struct associated_allocator<
ssl::detail::io_op<Stream, Operation, Handler>, Allocator>
template <template <typename, typename> class Associator,
typename Stream, typename Operation,
typename Handler, typename DefaultCandidate>
struct associator<Associator,
ssl::detail::io_op<Stream, Operation, Handler>,
DefaultCandidate>
: Associator<Handler, DefaultCandidate>
{
typedef typename associated_allocator<Handler, Allocator>::type type;
static type get(const ssl::detail::io_op<Stream, Operation, Handler>& h,
const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
static typename Associator<Handler, DefaultCandidate>::type
get(const ssl::detail::io_op<Stream, Operation, Handler>& h)
BOOST_ASIO_NOEXCEPT
{
return associated_allocator<Handler, Allocator>::get(h.handler_, a);
return Associator<Handler, DefaultCandidate>::get(h.handler_);
}
};
template <typename Stream, typename Operation,
typename Handler, typename Executor>
struct associated_executor<
ssl::detail::io_op<Stream, Operation, Handler>, Executor>
{
typedef typename associated_executor<Handler, Executor>::type type;
static type get(const ssl::detail::io_op<Stream, Operation, Handler>& h,
const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<Handler, DefaultCandidate>::type)
get(const ssl::detail::io_op<Stream, Operation, Handler>& h,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
{
return associated_executor<Handler, Executor>::get(h.handler_, ex);
return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
}
};

View File

@@ -2,7 +2,7 @@
// ssl/detail/openssl_init.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// ssl/detail/openssl_types.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -17,6 +17,9 @@
#include <boost/asio/detail/config.hpp>
#include <boost/asio/detail/socket_types.hpp>
#if defined(BOOST_ASIO_USE_WOLFSSL)
# include <wolfssl/options.h>
#endif // defined(BOOST_ASIO_USE_WOLFSSL)
#include <openssl/conf.h>
#include <openssl/ssl.h>
#if !defined(OPENSSL_NO_ENGINE)
@@ -25,6 +28,7 @@
#include <openssl/dh.h>
#include <openssl/err.h>
#include <openssl/rsa.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#endif // BOOST_ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP

View File

@@ -2,7 +2,7 @@
// ssl/detail/password_callback.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// ssl/detail/read_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -31,6 +31,11 @@ template <typename MutableBufferSequence>
class read_op
{
public:
static BOOST_ASIO_CONSTEXPR const char* tracking_name()
{
return "ssl::stream<>::async_read_some";
}
read_op(const MutableBufferSequence& buffers)
: buffers_(buffers)
{
@@ -52,7 +57,7 @@ public:
const boost::system::error_code& ec,
const std::size_t& bytes_transferred) const
{
handler(ec, bytes_transferred);
BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler)(ec, bytes_transferred);
}
private:

View File

@@ -2,7 +2,7 @@
// ssl/detail/shutdown_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -29,6 +29,11 @@ namespace detail {
class shutdown_op
{
public:
static BOOST_ASIO_CONSTEXPR const char* tracking_name()
{
return "ssl::stream<>::async_shutdown";
}
engine::want operator()(engine& eng,
boost::system::error_code& ec,
std::size_t& bytes_transferred) const
@@ -47,11 +52,11 @@ public:
// The engine only generates an eof when the shutdown notification has
// been received from the peer. This indicates that the shutdown has
// completed successfully, and thus need not be passed on to the handler.
handler(boost::system::error_code());
BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler)(boost::system::error_code());
}
else
{
handler(ec);
BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler)(ec);
}
}
};

View File

@@ -2,7 +2,7 @@
// ssl/detail/stream_core.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -52,10 +52,96 @@ struct stream_core
pending_write_.expires_at(neg_infin());
}
template <typename Executor>
stream_core(SSL* ssl_impl, const Executor& ex)
: engine_(ssl_impl),
pending_read_(ex),
pending_write_(ex),
output_buffer_space_(max_tls_record_size),
output_buffer_(boost::asio::buffer(output_buffer_space_)),
input_buffer_space_(max_tls_record_size),
input_buffer_(boost::asio::buffer(input_buffer_space_))
{
pending_read_.expires_at(neg_infin());
pending_write_.expires_at(neg_infin());
}
#if defined(BOOST_ASIO_HAS_MOVE)
stream_core(stream_core&& other)
: engine_(BOOST_ASIO_MOVE_CAST(engine)(other.engine_)),
#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
pending_read_(
BOOST_ASIO_MOVE_CAST(boost::asio::deadline_timer)(
other.pending_read_)),
pending_write_(
BOOST_ASIO_MOVE_CAST(boost::asio::deadline_timer)(
other.pending_write_)),
#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
pending_read_(
BOOST_ASIO_MOVE_CAST(boost::asio::steady_timer)(
other.pending_read_)),
pending_write_(
BOOST_ASIO_MOVE_CAST(boost::asio::steady_timer)(
other.pending_write_)),
#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
output_buffer_space_(
BOOST_ASIO_MOVE_CAST(std::vector<unsigned char>)(
other.output_buffer_space_)),
output_buffer_(other.output_buffer_),
input_buffer_space_(
BOOST_ASIO_MOVE_CAST(std::vector<unsigned char>)(
other.input_buffer_space_)),
input_buffer_(other.input_buffer_),
input_(other.input_)
{
other.output_buffer_ = boost::asio::mutable_buffer(0, 0);
other.input_buffer_ = boost::asio::mutable_buffer(0, 0);
other.input_ = boost::asio::const_buffer(0, 0);
}
#endif // defined(BOOST_ASIO_HAS_MOVE)
~stream_core()
{
}
#if defined(BOOST_ASIO_HAS_MOVE)
stream_core& operator=(stream_core&& other)
{
if (this != &other)
{
engine_ = BOOST_ASIO_MOVE_CAST(engine)(other.engine_);
#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
pending_read_ =
BOOST_ASIO_MOVE_CAST(boost::asio::deadline_timer)(
other.pending_read_);
pending_write_ =
BOOST_ASIO_MOVE_CAST(boost::asio::deadline_timer)(
other.pending_write_);
#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
pending_read_ =
BOOST_ASIO_MOVE_CAST(boost::asio::steady_timer)(
other.pending_read_);
pending_write_ =
BOOST_ASIO_MOVE_CAST(boost::asio::steady_timer)(
other.pending_write_);
#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
output_buffer_space_ =
BOOST_ASIO_MOVE_CAST(std::vector<unsigned char>)(
other.output_buffer_space_);
output_buffer_ = other.output_buffer_;
input_buffer_space_ =
BOOST_ASIO_MOVE_CAST(std::vector<unsigned char>)(
other.input_buffer_space_);
input_buffer_ = other.input_buffer_;
input_ = other.input_;
other.output_buffer_ = boost::asio::mutable_buffer(0, 0);
other.input_buffer_ = boost::asio::mutable_buffer(0, 0);
other.input_ = boost::asio::const_buffer(0, 0);
}
return *this;
}
#endif // defined(BOOST_ASIO_HAS_MOVE)
// The SSL engine.
engine engine_;
@@ -115,13 +201,13 @@ struct stream_core
std::vector<unsigned char> output_buffer_space_;
// A buffer that may be used to prepare output intended for the transport.
const boost::asio::mutable_buffer output_buffer_;
boost::asio::mutable_buffer output_buffer_;
// Buffer space used to read input intended for the engine.
std::vector<unsigned char> input_buffer_space_;
// A buffer that may be used to read input intended for the engine.
const boost::asio::mutable_buffer input_buffer_;
boost::asio::mutable_buffer input_buffer_;
// The buffer pointing to the engine's unconsumed input.
boost::asio::const_buffer input_;

View File

@@ -2,7 +2,7 @@
// ssl/detail/verify_callback.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// ssl/detail/write_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -31,6 +31,11 @@ template <typename ConstBufferSequence>
class write_op
{
public:
static BOOST_ASIO_CONSTEXPR const char* tracking_name()
{
return "ssl::stream<>::async_write_some";
}
write_op(const ConstBufferSequence& buffers)
: buffers_(buffers)
{
@@ -40,9 +45,13 @@ public:
boost::system::error_code& ec,
std::size_t& bytes_transferred) const
{
unsigned char storage[
boost::asio::detail::buffer_sequence_adapter<boost::asio::const_buffer,
ConstBufferSequence>::linearisation_storage_size];
boost::asio::const_buffer buffer =
boost::asio::detail::buffer_sequence_adapter<boost::asio::const_buffer,
ConstBufferSequence>::first(buffers_);
ConstBufferSequence>::linearise(buffers_, boost::asio::buffer(storage));
return eng.write(buffer, ec, bytes_transferred);
}
@@ -52,7 +61,7 @@ public:
const boost::system::error_code& ec,
const std::size_t& bytes_transferred) const
{
handler(ec, bytes_transferred);
BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler)(ec, bytes_transferred);
}
private: