diff options
Diffstat (limited to 'boost/asio/ssl/detail/stream_core.hpp')
-rw-r--r-- | boost/asio/ssl/detail/stream_core.hpp | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/boost/asio/ssl/detail/stream_core.hpp b/boost/asio/ssl/detail/stream_core.hpp index 70d1feddbb..95993e5f4e 100644 --- a/boost/asio/ssl/detail/stream_core.hpp +++ b/boost/asio/ssl/detail/stream_core.hpp @@ -17,15 +17,13 @@ #include <boost/asio/detail/config.hpp> -#if !defined(BOOST_ASIO_ENABLE_OLD_SSL) -# if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) -# include <boost/asio/deadline_timer.hpp> -# else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) -# include <boost/asio/steady_timer.hpp> -# endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) -# include <boost/asio/ssl/detail/engine.hpp> -# include <boost/asio/buffer.hpp> -#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL) +#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) +# include <boost/asio/deadline_timer.hpp> +#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) +# include <boost/asio/steady_timer.hpp> +#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) +#include <boost/asio/ssl/detail/engine.hpp> +#include <boost/asio/buffer.hpp> #include <boost/asio/detail/push_options.hpp> @@ -34,18 +32,16 @@ namespace asio { namespace ssl { namespace detail { -#if !defined(BOOST_ASIO_ENABLE_OLD_SSL) - struct stream_core { // According to the OpenSSL documentation, this is the buffer size that is // sufficient to hold the largest possible TLS record. enum { max_tls_record_size = 17 * 1024 }; - stream_core(SSL_CTX* context, boost::asio::io_service& io_service) + stream_core(SSL_CTX* context, boost::asio::io_context& io_context) : engine_(context), - pending_read_(io_service), - pending_write_(io_service), + pending_read_(io_context), + pending_write_(io_context), output_buffer_space_(max_tls_record_size), output_buffer_(boost::asio::buffer(output_buffer_space_)), input_buffer_space_(max_tls_record_size), @@ -80,6 +76,13 @@ struct stream_core { return boost::posix_time::pos_infin; } + + // Helper function to get a timer's expiry time. + static boost::asio::deadline_timer::time_type expiry( + const boost::asio::deadline_timer& timer) + { + return timer.expires_at(); + } #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // Timer used for storing queued read operations. boost::asio::steady_timer pending_read_; @@ -98,26 +101,31 @@ struct stream_core { return (boost::asio::steady_timer::time_point::max)(); } + + // Helper function to get a timer's expiry time. + static boost::asio::steady_timer::time_point expiry( + const boost::asio::steady_timer& timer) + { + return timer.expiry(); + } #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // Buffer space used to prepare output intended for the transport. std::vector<unsigned char> output_buffer_space_; // A buffer that may be used to prepare output intended for the transport. - const boost::asio::mutable_buffers_1 output_buffer_; + const 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_buffers_1 input_buffer_; + const boost::asio::mutable_buffer input_buffer_; // The buffer pointing to the engine's unconsumed input. boost::asio::const_buffer input_; }; -#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL) - } // namespace detail } // namespace ssl } // namespace asio |