diff options
Diffstat (limited to 'boost/asio/ssl/detail/stream_core.hpp')
-rw-r--r-- | boost/asio/ssl/detail/stream_core.hpp | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/boost/asio/ssl/detail/stream_core.hpp b/boost/asio/ssl/detail/stream_core.hpp index b8f0afa4a1..663e258c03 100644 --- a/boost/asio/ssl/detail/stream_core.hpp +++ b/boost/asio/ssl/detail/stream_core.hpp @@ -2,7 +2,7 @@ // ssl/detail/stream_core.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2014 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) @@ -18,7 +18,11 @@ #include <boost/asio/detail/config.hpp> #if !defined(BOOST_ASIO_ENABLE_OLD_SSL) -# include <boost/asio/deadline_timer.hpp> +# 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) @@ -34,7 +38,7 @@ namespace detail { struct stream_core { - // According to the OpenSSL documentation, this is the buffer size that is is + // 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 }; @@ -47,8 +51,8 @@ struct stream_core input_buffer_space_(max_tls_record_size), input_buffer_(boost::asio::buffer(input_buffer_space_)) { - pending_read_.expires_at(boost::posix_time::neg_infin); - pending_write_.expires_at(boost::posix_time::neg_infin); + pending_read_.expires_at(neg_infin()); + pending_write_.expires_at(neg_infin()); } ~stream_core() @@ -58,20 +62,52 @@ struct stream_core // The SSL engine. engine engine_; +#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // Timer used for storing queued read operations. boost::asio::deadline_timer pending_read_; // Timer used for storing queued write operations. boost::asio::deadline_timer pending_write_; + // Helper function for obtaining a time value that always fires. + static boost::asio::deadline_timer::time_type neg_infin() + { + return boost::posix_time::neg_infin; + } + + // Helper function for obtaining a time value that never fires. + static boost::asio::deadline_timer::time_type pos_infin() + { + return boost::posix_time::pos_infin; + } +#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) + // Timer used for storing queued read operations. + boost::asio::steady_timer pending_read_; + + // Timer used for storing queued write operations. + boost::asio::steady_timer pending_write_; + + // Helper function for obtaining a time value that always fires. + static boost::asio::steady_timer::time_point neg_infin() + { + return (boost::asio::steady_timer::time_point::min)(); + } + + // Helper function for obtaining a time value that never fires. + static boost::asio::steady_timer::time_point pos_infin() + { + return (boost::asio::steady_timer::time_point::max)(); + } +#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_; + 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_buffers_1 output_buffer_; // Buffer space used to read input intended for the engine. - std::vector<unsigned char> input_buffer_space_; + 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_; |