diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:21:30 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:21:30 +0900 |
commit | d6a306e745acfee00e81ccaf3324a2a03516db41 (patch) | |
tree | 145a26368608982f40ebb0f4836185c44abb9ae4 /boost/asio | |
parent | 5ce2ccf2f23c6d3de4c79f216f57ca6f2a18ed16 (diff) | |
download | boost-d6a306e745acfee00e81ccaf3324a2a03516db41.tar.gz boost-d6a306e745acfee00e81ccaf3324a2a03516db41.tar.bz2 boost-d6a306e745acfee00e81ccaf3324a2a03516db41.zip |
Imported Upstream version 1.69.0upstream/1.69.0
Diffstat (limited to 'boost/asio')
26 files changed, 305 insertions, 139 deletions
diff --git a/boost/asio/buffer.hpp b/boost/asio/buffer.hpp index 8abe0be499..29352f6481 100644 --- a/boost/asio/buffer.hpp +++ b/boost/asio/buffer.hpp @@ -23,7 +23,6 @@ #include <string> #include <vector> #include <boost/asio/detail/array_fwd.hpp> -#include <boost/asio/detail/is_buffer_sequence.hpp> #include <boost/asio/detail/string_view.hpp> #include <boost/asio/detail/throw_exception.hpp> #include <boost/asio/detail/type_traits.hpp> @@ -347,41 +346,6 @@ public: #endif // !defined(BOOST_ASIO_NO_DEPRECATED) -/// Trait to determine whether a type satisfies the MutableBufferSequence -/// requirements. -template <typename T> -struct is_mutable_buffer_sequence -#if defined(GENERATING_DOCUMENTATION) - : integral_constant<bool, automatically_determined> -#else // defined(GENERATING_DOCUMENTATION) - : boost::asio::detail::is_buffer_sequence<T, mutable_buffer> -#endif // defined(GENERATING_DOCUMENTATION) -{ -}; - -/// Trait to determine whether a type satisfies the ConstBufferSequence -/// requirements. -template <typename T> -struct is_const_buffer_sequence -#if defined(GENERATING_DOCUMENTATION) - : integral_constant<bool, automatically_determined> -#else // defined(GENERATING_DOCUMENTATION) - : boost::asio::detail::is_buffer_sequence<T, const_buffer> -#endif // defined(GENERATING_DOCUMENTATION) -{ -}; - -/// Trait to determine whether a type satisfies the DynamicBuffer requirements. -template <typename T> -struct is_dynamic_buffer -#if defined(GENERATING_DOCUMENTATION) - : integral_constant<bool, automatically_determined> -#else // defined(GENERATING_DOCUMENTATION) - : boost::asio::detail::is_dynamic_buffer<T> -#endif // defined(GENERATING_DOCUMENTATION) -{ -}; - /// (Deprecated: Use the socket/descriptor wait() and async_wait() member /// functions.) An implementation of both the ConstBufferSequence and /// MutableBufferSequence concepts to represent a null buffer sequence. @@ -1404,7 +1368,7 @@ inline BOOST_ASIO_MUTABLE_BUFFER buffer( ); } -/// Create a new non-modifiable buffer that represents the given string. +/// Create a new modifiable buffer that represents the given string. /** * @returns A mutable_buffer value equivalent to: * @code mutable_buffer( @@ -2160,5 +2124,50 @@ inline std::size_t buffer_copy(const MutableBufferSequence& target, } // namespace boost #include <boost/asio/detail/pop_options.hpp> +#include <boost/asio/detail/is_buffer_sequence.hpp> +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Trait to determine whether a type satisfies the MutableBufferSequence +/// requirements. +template <typename T> +struct is_mutable_buffer_sequence +#if defined(GENERATING_DOCUMENTATION) + : integral_constant<bool, automatically_determined> +#else // defined(GENERATING_DOCUMENTATION) + : boost::asio::detail::is_buffer_sequence<T, mutable_buffer> +#endif // defined(GENERATING_DOCUMENTATION) +{ +}; + +/// Trait to determine whether a type satisfies the ConstBufferSequence +/// requirements. +template <typename T> +struct is_const_buffer_sequence +#if defined(GENERATING_DOCUMENTATION) + : integral_constant<bool, automatically_determined> +#else // defined(GENERATING_DOCUMENTATION) + : boost::asio::detail::is_buffer_sequence<T, const_buffer> +#endif // defined(GENERATING_DOCUMENTATION) +{ +}; + +/// Trait to determine whether a type satisfies the DynamicBuffer requirements. +template <typename T> +struct is_dynamic_buffer +#if defined(GENERATING_DOCUMENTATION) + : integral_constant<bool, automatically_determined> +#else // defined(GENERATING_DOCUMENTATION) + : boost::asio::detail::is_dynamic_buffer<T> +#endif // defined(GENERATING_DOCUMENTATION) +{ +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_BUFFER_HPP diff --git a/boost/asio/connect.hpp b/boost/asio/connect.hpp index 5dd5268bc4..03296885dd 100644 --- a/boost/asio/connect.hpp +++ b/boost/asio/connect.hpp @@ -59,7 +59,8 @@ struct is_endpoint_sequence /** * @defgroup connect boost::asio::connect * - * @brief Establishes a socket connection by trying each endpoint in a sequence. + * @brief The @c connect function is a composed operation that establishes a + * socket connection by trying each endpoint in a sequence. */ /*@{*/ @@ -132,8 +133,8 @@ typename Protocol::endpoint connect( EndpointSequence>::value>::type* = 0); #if !defined(BOOST_ASIO_NO_DEPRECATED) -/// (Deprecated.) Establishes a socket connection by trying each endpoint in a -/// sequence. +/// (Deprecated: Use range overload.) Establishes a socket connection by trying +/// each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member @@ -160,8 +161,8 @@ template <typename Protocol BOOST_ASIO_SVC_TPARAM, typename Iterator> Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, Iterator begin, typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0); -/// (Deprecated.) Establishes a socket connection by trying each endpoint in a -/// sequence. +/// (Deprecated: Use range overload.) Establishes a socket connection by trying +/// each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member @@ -387,8 +388,8 @@ typename Protocol::endpoint connect( EndpointSequence>::value>::type* = 0); #if !defined(BOOST_ASIO_NO_DEPRECATED) -/// (Deprecated.) Establishes a socket connection by trying each endpoint in a -/// sequence. +/// (Deprecated: Use range overload.) Establishes a socket connection by trying +/// each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member @@ -428,8 +429,8 @@ Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, Iterator begin, ConnectCondition connect_condition, typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0); -/// (Deprecated.) Establishes a socket connection by trying each endpoint in a -/// sequence. +/// (Deprecated: Use range overload.) Establishes a socket connection by trying +/// each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member @@ -603,8 +604,8 @@ Iterator connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, /** * @defgroup async_connect boost::asio::async_connect * - * @brief Asynchronously establishes a socket connection by trying each - * endpoint in a sequence. + * @brief The @c async_connect function is a composed asynchronous operation + * that establishes a socket connection by trying each endpoint in a sequence. */ /*@{*/ @@ -680,8 +681,8 @@ async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, EndpointSequence>::value>::type* = 0); #if !defined(BOOST_ASIO_NO_DEPRECATED) -/// (Deprecated.) Asynchronously establishes a socket connection by trying each -/// endpoint in a sequence. +/// (Deprecated: Use range overload.) Asynchronously establishes a socket +/// connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c async_connect @@ -887,8 +888,8 @@ async_connect(basic_socket<Protocol BOOST_ASIO_SVC_TARG>& s, EndpointSequence>::value>::type* = 0); #if !defined(BOOST_ASIO_NO_DEPRECATED) -/// (Deprecated.) Asynchronously establishes a socket connection by trying each -/// endpoint in a sequence. +/// (Deprecated: Use range overload.) Asynchronously establishes a socket +/// connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c async_connect diff --git a/boost/asio/detail/config.hpp b/boost/asio/detail/config.hpp index 126be7e64f..2453425315 100644 --- a/boost/asio/detail/config.hpp +++ b/boost/asio/detail/config.hpp @@ -70,9 +70,6 @@ # define BOOST_ASIO_MSVC _MSC_VER # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC) #endif // !defined(BOOST_ASIO_MSVC) -#if defined(BOOST_ASIO_MSVC) -# include <ciso646> // Needed for _HAS_CXX17. -#endif // defined(BOOST_ASIO_MSVC) // Clang / libc++ detection. #if defined(__clang__) @@ -111,6 +108,14 @@ # define BOOST_ASIO_HAS_MOVE 1 # endif // (_MSC_VER >= 1700) # endif // defined(BOOST_ASIO_MSVC) +# if defined(__INTEL_CXX11_MODE__) +# if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500) +# define BOOST_ASIO_HAS_MOVE 1 +# endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500) +# if defined(__ICL) && (__ICL >= 1500) +# define BOOST_ASIO_HAS_MOVE 1 +# endif // defined(__ICL) && (__ICL >= 1500) +# endif // defined(__INTEL_CXX11_MODE__) # endif // !defined(BOOST_ASIO_DISABLE_MOVE) #endif // !defined(BOOST_ASIO_HAS_MOVE) @@ -229,7 +234,7 @@ // Support noexcept on compilers known to allow it. #if !defined(BOOST_ASIO_NOEXCEPT) # if !defined(BOOST_ASIO_DISABLE_NOEXCEPT) -# if (BOOST_VERSION >= 105300) +# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105300) # define BOOST_ASIO_NOEXCEPT BOOST_NOEXCEPT # define BOOST_ASIO_NOEXCEPT_OR_NOTHROW BOOST_NOEXCEPT_OR_NOTHROW # elif defined(__clang__) @@ -759,9 +764,7 @@ # if defined(__GNUC__) # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) # if defined(__GXX_EXPERIMENTAL_CXX0X__) -# if defined(_GLIBCXX_HAS_GTHREADS) -# define BOOST_ASIO_HAS_STD_FUTURE 1 -# endif // defined(_GLIBCXX_HAS_GTHREADS) +# define BOOST_ASIO_HAS_STD_FUTURE 1 # endif // defined(__GXX_EXPERIMENTAL_CXX0X__) # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) # endif // defined(__GNUC__) @@ -777,23 +780,29 @@ #if !defined(BOOST_ASIO_HAS_STD_STRING_VIEW) # if !defined(BOOST_ASIO_DISABLE_STD_STRING_VIEW) # if defined(__clang__) -# if (__cplusplus >= 201703) -# if __has_include(<string_view>) -# define BOOST_ASIO_HAS_STD_STRING_VIEW 1 -# endif // __has_include(<string_view>) -# endif // (__cplusplus >= 201703) -# endif // defined(__clang__) -# if defined(__GNUC__) +# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX) +# if (__cplusplus >= 201402) +# if __has_include(<string_view>) +# define BOOST_ASIO_HAS_STD_STRING_VIEW 1 +# endif // __has_include(<string_view>) +# endif // (__cplusplus >= 201402) +# else // defined(BOOST_ASIO_HAS_CLANG_LIBCXX) +# if (__cplusplus >= 201703) +# if __has_include(<string_view>) +# define BOOST_ASIO_HAS_STD_STRING_VIEW 1 +# endif // __has_include(<string_view>) +# endif // (__cplusplus >= 201703) +# endif // defined(BOOST_ASIO_HAS_CLANG_LIBCXX) +# elif defined(__GNUC__) # if (__GNUC__ >= 7) # if (__cplusplus >= 201703) # define BOOST_ASIO_HAS_STD_STRING_VIEW 1 # endif // (__cplusplus >= 201703) # endif // (__GNUC__ >= 7) -# endif // defined(__GNUC__) -# if defined(BOOST_ASIO_MSVC) -# if (_MSC_VER >= 1910 && _HAS_CXX17) -# define BOOST_ASIO_HAS_STD_STRING_VIEW -# endif // (_MSC_VER >= 1910 && _HAS_CXX17) +# elif defined(BOOST_ASIO_MSVC) +# if (_MSC_VER >= 1910 && _MSVC_LANG >= 201703) +# define BOOST_ASIO_HAS_STD_STRING_VIEW 1 +# endif // (_MSC_VER >= 1910 && _MSVC_LANG >= 201703) # endif // defined(BOOST_ASIO_MSVC) # endif // !defined(BOOST_ASIO_DISABLE_STD_STRING_VIEW) #endif // !defined(BOOST_ASIO_HAS_STD_STRING_VIEW) @@ -802,11 +811,21 @@ #if !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) # if !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW) # if defined(__clang__) -# if (__cplusplus >= 201402) -# if __has_include(<experimental/string_view>) -# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 -# endif // __has_include(<experimental/string_view>) -# endif // (__cplusplus >= 201402) +# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX) +# if (_LIBCPP_VERSION < 7000) +# if (__cplusplus >= 201402) +# if __has_include(<experimental/string_view>) +# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 +# endif // __has_include(<experimental/string_view>) +# endif // (__cplusplus >= 201402) +# endif // (_LIBCPP_VERSION < 7000) +# else // defined(BOOST_ASIO_HAS_CLANG_LIBCXX) +# if (__cplusplus >= 201402) +# if __has_include(<experimental/string_view>) +# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 +# endif // __has_include(<experimental/string_view>) +# endif // (__cplusplus >= 201402) +# endif // // defined(BOOST_ASIO_HAS_CLANG_LIBCXX) # endif // defined(__clang__) # if defined(__GNUC__) # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4) @@ -851,9 +870,9 @@ #if !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT) # if !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT) # if defined(BOOST_ASIO_MSVC) -# if (_MSC_VER >= 1910 && _HAS_CXX17) +# if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703) # define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1 -# endif // (_MSC_VER >= 1910 && _HAS_CXX17) +# endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703) # endif // defined(BOOST_ASIO_MSVC) # endif // !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT) #endif // !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT) diff --git a/boost/asio/detail/future.hpp b/boost/asio/detail/future.hpp new file mode 100644 index 0000000000..38cc7c1e83 --- /dev/null +++ b/boost/asio/detail/future.hpp @@ -0,0 +1,33 @@ +// +// detail/future.hpp +// ~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2018 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) +// + +#ifndef BOOST_ASIO_DETAIL_FUTURE_HPP +#define BOOST_ASIO_DETAIL_FUTURE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#if defined(BOOST_ASIO_HAS_STD_FUTURE) +# include <future> +// Even though the future header is available, libstdc++ may not implement the +// std::future class itself. However, we need to have already included the +// future header to reliably test for _GLIBCXX_HAS_GTHREADS. +# if defined(__GNUC__) && !defined(BOOST_ASIO_HAS_CLANG_LIBCXX) +# if defined(_GLIBCXX_HAS_GTHREADS) +# define BOOST_ASIO_HAS_STD_FUTURE_CLASS 1 +# endif // defined(_GLIBCXX_HAS_GTHREADS) +# else // defined(__GNUC__) && !defined(BOOST_ASIO_HAS_CLANG_LIBCXX) +# define BOOST_ASIO_HAS_STD_FUTURE_CLASS 1 +# endif // defined(__GNUC__) && !defined(BOOST_ASIO_HAS_CLANG_LIBCXX) +#endif // defined(BOOST_ASIO_HAS_STD_FUTURE) + +#endif // BOOST_ASIO_DETAIL_FUTURE_HPP diff --git a/boost/asio/detail/impl/socket_ops.ipp b/boost/asio/detail/impl/socket_ops.ipp index 3442ac3de1..bb60df0a8e 100644 --- a/boost/asio/detail/impl/socket_ops.ipp +++ b/boost/asio/detail/impl/socket_ops.ipp @@ -2115,7 +2115,7 @@ const char* inet_ntop(int af, const void* src, char* dest, size_t length, if (result != 0 && af == BOOST_ASIO_OS_DEF(AF_INET6) && scope_id != 0) { using namespace std; // For strcat and sprintf. - char if_name[IF_NAMESIZE + 1] = "%"; + char if_name[(IF_NAMESIZE > 21 ? IF_NAMESIZE : 21) + 1] = "%"; const in6_addr_type* ipv6_address = static_cast<const in6_addr_type*>(src); bool is_link_local = ((ipv6_address->s6_addr[0] == 0xfe) && ((ipv6_address->s6_addr[1] & 0xc0) == 0x80)); diff --git a/boost/asio/detail/is_buffer_sequence.hpp b/boost/asio/detail/is_buffer_sequence.hpp index 370b2c81c0..a3fb9931d2 100644 --- a/boost/asio/detail/is_buffer_sequence.hpp +++ b/boost/asio/detail/is_buffer_sequence.hpp @@ -53,23 +53,47 @@ struct buffer_sequence_memfns_check }; template <typename> -char (&begin_memfn_helper(...))[2]; +char (&buffer_sequence_begin_helper(...))[2]; + +#if defined(BOOST_ASIO_HAS_DECLTYPE) template <typename T> -char begin_memfn_helper( +char buffer_sequence_begin_helper(T* t, + typename enable_if<!is_same< + decltype(boost::asio::buffer_sequence_begin(*t)), + void>::value>::type*); + +#else // defined(BOOST_ASIO_HAS_DECLTYPE) + +template <typename T> +char buffer_sequence_begin_helper(T* t, buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived<T>::begin>*); +#endif // defined(BOOST_ASIO_HAS_DECLTYPE) + template <typename> -char (&end_memfn_helper(...))[2]; +char (&buffer_sequence_end_helper(...))[2]; + +#if defined(BOOST_ASIO_HAS_DECLTYPE) template <typename T> -char end_memfn_helper( +char buffer_sequence_end_helper(T* t, + typename enable_if<!is_same< + decltype(boost::asio::buffer_sequence_end(*t)), + void>::value>::type*); + +#else // defined(BOOST_ASIO_HAS_DECLTYPE) + +template <typename T> +char buffer_sequence_end_helper(T* t, buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived<T>::end>*); +#endif // defined(BOOST_ASIO_HAS_DECLTYPE) + template <typename> char (&size_memfn_helper(...))[2]; @@ -134,25 +158,25 @@ char consume_memfn_helper( &buffer_sequence_memfns_derived<T>::consume>*); template <typename, typename> -char (&buffer_element_type_helper(...))[2]; +char (&buffer_sequence_element_type_helper(...))[2]; -#if defined(BOOST_ASIO_HAS_DECL_TYPE) +#if defined(BOOST_ASIO_HAS_DECLTYPE) template <typename T, typename Buffer> -char buffer_element_type_helper(T* t, +char buffer_sequence_element_type_helper(T* t, typename enable_if<is_convertible< - decltype(*buffer_sequence_begin(*t)), + decltype(*boost::asio::buffer_sequence_begin(*t)), Buffer>::value>::type*); -#else // defined(BOOST_ASIO_HAS_DECL_TYPE) +#else // defined(BOOST_ASIO_HAS_DECLTYPE) template <typename T, typename Buffer> -char buffer_element_type_helper( +char buffer_sequence_element_type_helper( typename T::const_iterator*, typename enable_if<is_convertible< typename T::value_type, Buffer>::value>::type*); -#endif // defined(BOOST_ASIO_HAS_DECL_TYPE) +#endif // defined(BOOST_ASIO_HAS_DECLTYPE) template <typename> char (&const_buffers_type_typedef_helper(...))[2]; @@ -171,9 +195,9 @@ char mutable_buffers_type_typedef_helper( template <typename T, typename Buffer> struct is_buffer_sequence_class : integral_constant<bool, - sizeof(begin_memfn_helper<T>(0)) != 1 && - sizeof(end_memfn_helper<T>(0)) != 1 && - sizeof(buffer_element_type_helper<T, Buffer>(0, 0)) == 1> + sizeof(buffer_sequence_begin_helper<T>(0)) != 1 && + sizeof(buffer_sequence_end_helper<T>(0)) != 1 && + sizeof(buffer_sequence_element_type_helper<T, Buffer>(0, 0)) == 1> { }; diff --git a/boost/asio/detail/timer_queue.hpp b/boost/asio/detail/timer_queue.hpp index 99e12e0902..3b2bcff774 100644 --- a/boost/asio/detail/timer_queue.hpp +++ b/boost/asio/detail/timer_queue.hpp @@ -267,11 +267,13 @@ private: { if (index == heap_.size() - 1) { + timer.heap_index_ = (std::numeric_limits<std::size_t>::max)(); heap_.pop_back(); } else { swap_heap(index, heap_.size() - 1); + timer.heap_index_ = (std::numeric_limits<std::size_t>::max)(); heap_.pop_back(); if (index > 0 && Time_Traits::less_than( heap_[index].time_, heap_[(index - 1) / 2].time_)) diff --git a/boost/asio/detail/win_global.hpp b/boost/asio/detail/win_global.hpp index 4234a6d4e0..11204dec6d 100644 --- a/boost/asio/detail/win_global.hpp +++ b/boost/asio/detail/win_global.hpp @@ -59,7 +59,8 @@ T& win_global() { win_global_impl<T>::mutex_.init(); static_mutex::scoped_lock lock(win_global_impl<T>::mutex_); - win_global_impl<T>::ptr_ = new T; + if (win_global_impl<T>::ptr_ == 0) + win_global_impl<T>::ptr_ = new T; win_global_impl<T>::tss_ptr_ = win_global_impl<T>::ptr_; } diff --git a/boost/asio/impl/io_context.hpp b/boost/asio/impl/io_context.hpp index 21dd83688c..37f8ace42a 100644 --- a/boost/asio/impl/io_context.hpp +++ b/boost/asio/impl/io_context.hpp @@ -250,7 +250,7 @@ void io_context::executor_type::dispatch( p.p = new (p.v) op(BOOST_ASIO_MOVE_CAST(Function)(f), a); BOOST_ASIO_HANDLER_CREATION((this->context(), *p.p, - "io_context", &this->context(), 0, "post")); + "io_context", &this->context(), 0, "dispatch")); io_context_.impl_.post_immediate_completion(p.p, false); p.v = p.p = 0; diff --git a/boost/asio/impl/read_until.hpp b/boost/asio/impl/read_until.hpp index 704a97946b..8bc959557a 100644 --- a/boost/asio/impl/read_until.hpp +++ b/boost/asio/impl/read_until.hpp @@ -270,7 +270,9 @@ std::size_t read_until(SyncReadStream& s, } // Need more data. - std::size_t bytes_to_read = read_size_helper(b, 65536); + std::size_t bytes_to_read = std::min<std::size_t>( + std::max<std::size_t>(512, b.capacity() - b.size()), + std::min<std::size_t>(65536, b.max_size() - b.size())); b.commit(s.read_some(b.prepare(bytes_to_read), ec)); if (ec) return 0; diff --git a/boost/asio/impl/use_future.hpp b/boost/asio/impl/use_future.hpp index a0e22acad3..fd75a7c8e8 100644 --- a/boost/asio/impl/use_future.hpp +++ b/boost/asio/impl/use_future.hpp @@ -16,7 +16,6 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <future> #include <tuple> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/memory.hpp> diff --git a/boost/asio/ip/bad_address_cast.hpp b/boost/asio/ip/bad_address_cast.hpp index 4e62bcd32b..fce9f053b1 100644 --- a/boost/asio/ip/bad_address_cast.hpp +++ b/boost/asio/ip/bad_address_cast.hpp @@ -25,7 +25,12 @@ namespace asio { namespace ip { /// Thrown to indicate a failed address conversion. -class bad_address_cast : public std::bad_cast +class bad_address_cast : +#if defined(BOOST_ASIO_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS + public std::exception +#else + public std::bad_cast +#endif { public: /// Default constructor. diff --git a/boost/asio/ip/basic_resolver.hpp b/boost/asio/ip/basic_resolver.hpp index 969d9d8ac3..4979d104cf 100644 --- a/boost/asio/ip/basic_resolver.hpp +++ b/boost/asio/ip/basic_resolver.hpp @@ -199,7 +199,8 @@ public: } #if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated.) Perform forward resolution of a query to a list of entries. + /// (Deprecated: Use overload with separate host and service parameters.) + /// Perform forward resolution of a query to a list of entries. /** * This function is used to resolve a query into a list of endpoint entries. * @@ -220,7 +221,8 @@ public: return r; } - /// (Deprecated.) Perform forward resolution of a query to a list of entries. + /// (Deprecated: Use overload with separate host and service parameters.) + /// Perform forward resolution of a query to a list of entries. /** * This function is used to resolve a query into a list of endpoint entries. * @@ -601,8 +603,8 @@ public: } #if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated.) Asynchronously perform forward resolution of a query to a - /// list of entries. + /// (Deprecated: Use overload with separate host and service parameters.) + /// Asynchronously perform forward resolution of a query to a list of entries. /** * This function is used to asynchronously resolve a query into a list of * endpoint entries. diff --git a/boost/asio/ip/basic_resolver_results.hpp b/boost/asio/ip/basic_resolver_results.hpp index dc87dbffc8..f553930cfc 100644 --- a/boost/asio/ip/basic_resolver_results.hpp +++ b/boost/asio/ip/basic_resolver_results.hpp @@ -233,19 +233,19 @@ public: /// Get the number of entries in the results range. size_type size() const BOOST_ASIO_NOEXCEPT { - return this->values_->size(); + return this->values_ ? this->values_->size() : 0; } /// Get the maximum number of entries permitted in a results range. size_type max_size() const BOOST_ASIO_NOEXCEPT { - return this->values_->max_size(); + return this->values_ ? this->values_->max_size() : values_type().max_size(); } /// Determine whether the results range is empty. bool empty() const BOOST_ASIO_NOEXCEPT { - return this->values_->empty(); + return this->values_ ? this->values_->empty() : true; } /// Obtain a begin iterator for the results range. @@ -253,7 +253,7 @@ public: { basic_resolver_results tmp(*this); tmp.index_ = 0; - return tmp; + return BOOST_ASIO_MOVE_CAST(basic_resolver_results)(tmp); } /// Obtain an end iterator for the results range. diff --git a/boost/asio/packaged_task.hpp b/boost/asio/packaged_task.hpp index da6c5aeaa8..4928a1cc7a 100644 --- a/boost/asio/packaged_task.hpp +++ b/boost/asio/packaged_task.hpp @@ -16,11 +16,11 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/future.hpp> -#if defined(BOOST_ASIO_HAS_STD_FUTURE) \ +#if defined(BOOST_ASIO_HAS_STD_FUTURE_CLASS) \ || defined(GENERATING_DOCUMENTATION) -#include <future> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/variadic_templates.hpp> @@ -122,7 +122,7 @@ private: #include <boost/asio/detail/pop_options.hpp> -#endif // defined(BOOST_ASIO_HAS_STD_FUTURE) +#endif // defined(BOOST_ASIO_HAS_STD_FUTURE_CLASS) // || defined(GENERATING_DOCUMENTATION) #endif // BOOST_ASIO_PACKAGED_TASK_HPP diff --git a/boost/asio/read.hpp b/boost/asio/read.hpp index cffc847769..efa373c3cf 100644 --- a/boost/asio/read.hpp +++ b/boost/asio/read.hpp @@ -33,8 +33,8 @@ namespace asio { /** * @defgroup read boost::asio::read * - * @brief Attempt to read a certain amount of data from a stream before - * returning. + * @brief The @c read function is a composed operation that reads a certain + * amount of data from a stream before returning. */ /*@{*/ @@ -533,8 +533,8 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, /** * @defgroup async_read boost::asio::async_read * - * @brief Start an asynchronous operation to read a certain amount of data from - * a stream. + * @brief The @c async_read function is a composed asynchronous operation that + * reads a certain amount of data from a stream before completion. */ /*@{*/ diff --git a/boost/asio/read_at.hpp b/boost/asio/read_at.hpp index 2927ddd1ff..ec6780382b 100644 --- a/boost/asio/read_at.hpp +++ b/boost/asio/read_at.hpp @@ -33,8 +33,8 @@ namespace asio { /** * @defgroup read_at boost::asio::read_at * - * @brief Attempt to read a certain amount of data at the specified offset - * before returning. + * @brief The @c read_at function is a composed operation that reads a certain + * amount of data at the specified offset before returning. */ /*@{*/ @@ -395,8 +395,8 @@ std::size_t read_at(SyncRandomAccessReadDevice& d, /** * @defgroup async_read_at boost::asio::async_read_at * - * @brief Start an asynchronous operation to read a certain amount of data at - * the specified offset. + * @brief The @c async_read_at function is a composed asynchronous operation + * that reads a certain amount of data at the specified offset. */ /*@{*/ diff --git a/boost/asio/read_until.hpp b/boost/asio/read_until.hpp index 7b66b7fe43..f9c1f51323 100644 --- a/boost/asio/read_until.hpp +++ b/boost/asio/read_until.hpp @@ -68,9 +68,10 @@ struct is_match_condition /** * @defgroup read_until boost::asio::read_until * - * @brief Read data into a dynamic buffer sequence, or into a streambuf, until - * it contains a delimiter, matches a regular expression, or a function object - * indicates a match. + * @brief The @c read_until function is a composed operation that reads data + * into a dynamic buffer sequence, or into a streambuf, until it contains a + * delimiter, matches a regular expression, or a function object indicates a + * match. */ /*@{*/ @@ -986,9 +987,10 @@ std::size_t read_until(SyncReadStream& s, /** * @defgroup async_read_until boost::asio::async_read_until * - * @brief Start an asynchronous operation to read data into a dynamic buffer - * sequence, or into a streambuf, until it contains a delimiter, matches a - * regular expression, or a function object indicates a match. + * @brief The @c async_read_until function is a composed asynchronous operation + * that reads data into a dynamic buffer sequence, or into a streambuf, until + * it contains a delimiter, matches a regular expression, or a function object + * indicates a match. */ /*@{*/ diff --git a/boost/asio/ssl/context_base.hpp b/boost/asio/ssl/context_base.hpp index 8671ee676a..625ccc7b5b 100644 --- a/boost/asio/ssl/context_base.hpp +++ b/boost/asio/ssl/context_base.hpp @@ -86,6 +86,15 @@ public: /// TLS version 1.2 server. tlsv12_server, + /// Generic TLS version 1.3. + tlsv13, + + /// TLS version 1.3 client. + tlsv13_client, + + /// TLS version 1.3 server. + tlsv13_server, + /// Generic TLS. tls, @@ -121,6 +130,9 @@ public: /// Disable TLS v1.2. static const long no_tlsv1_2 = implementation_defined; + /// Disable TLS v1.3. + static const long no_tlsv1_3 = implementation_defined; + /// Disable compression. Compression is disabled by default. static const long no_compression = implementation_defined; #else @@ -139,6 +151,11 @@ public: # else // defined(SSL_OP_NO_TLSv1_2) BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1_2 = 0x08000000L); # endif // defined(SSL_OP_NO_TLSv1_2) +# if defined(SSL_OP_NO_TLSv1_3) + BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1_3 = SSL_OP_NO_TLSv1_3); +# else // defined(SSL_OP_NO_TLSv1_3) + BOOST_ASIO_STATIC_CONSTANT(long, no_tlsv1_3 = 0x20000000L); +# endif // defined(SSL_OP_NO_TLSv1_3) # if defined(SSL_OP_NO_COMPRESSION) BOOST_ASIO_STATIC_CONSTANT(long, no_compression = SSL_OP_NO_COMPRESSION); # else // defined(SSL_OP_NO_COMPRESSION) diff --git a/boost/asio/ssl/impl/context.ipp b/boost/asio/ssl/impl/context.ipp index f35e43c2a6..b331dea45d 100644 --- a/boost/asio/ssl/impl/context.ipp +++ b/boost/asio/ssl/impl/context.ipp @@ -158,7 +158,7 @@ context::context(context::method m) SSL_CTX_set_max_proto_version(handle_, TLS1_VERSION); } break; -#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) +#elif defined(SSL_TXT_TLSV1) case context::tlsv1: handle_ = ::SSL_CTX_new(::TLSv1_method()); break; @@ -168,7 +168,14 @@ context::context(context::method m) case context::tlsv1_server: handle_ = ::SSL_CTX_new(::TLSv1_server_method()); break; -#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) +#else // defined(SSL_TXT_TLSV1) + case context::tlsv1: + case context::tlsv1_client: + case context::tlsv1_server: + boost::asio::detail::throw_error( + boost::asio::error::invalid_argument, "context"); + break; +#endif // defined(SSL_TXT_TLSV1) // TLS v1.1. #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) @@ -241,7 +248,7 @@ context::context(context::method m) SSL_CTX_set_max_proto_version(handle_, TLS1_2_VERSION); } break; -#elif defined(SSL_TXT_TLSV1_1) +#elif defined(SSL_TXT_TLSV1_2) case context::tlsv12: handle_ = ::SSL_CTX_new(::TLSv1_2_method()); break; @@ -251,14 +258,52 @@ context::context(context::method m) case context::tlsv12_server: handle_ = ::SSL_CTX_new(::TLSv1_2_server_method()); break; -#else // defined(SSL_TXT_TLSV1_1) +#else // defined(SSL_TXT_TLSV1_2) case context::tlsv12: case context::tlsv12_client: case context::tlsv12_server: boost::asio::detail::throw_error( boost::asio::error::invalid_argument, "context"); break; -#endif // defined(SSL_TXT_TLSV1_1) +#endif // defined(SSL_TXT_TLSV1_2) + + // TLS v1.3. +#if (OPENSSL_VERSION_NUMBER >= 0x10101000L) \ + && !defined(LIBRESSL_VERSION_NUMBER) + case context::tlsv13: + handle_ = ::SSL_CTX_new(::TLS_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_3_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_3_VERSION); + } + break; + case context::tlsv13_client: + handle_ = ::SSL_CTX_new(::TLS_client_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_3_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_3_VERSION); + } + break; + case context::tlsv13_server: + handle_ = ::SSL_CTX_new(::TLS_server_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_3_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_3_VERSION); + } + break; +#else // (OPENSSL_VERSION_NUMBER >= 0x10101000L) + // && !defined(LIBRESSL_VERSION_NUMBER) + case context::tlsv13: + case context::tlsv13_client: + case context::tlsv13_server: + boost::asio::detail::throw_error( + boost::asio::error::invalid_argument, "context"); + break; +#endif // (OPENSSL_VERSION_NUMBER >= 0x10101000L) + // && !defined(LIBRESSL_VERSION_NUMBER) // Any supported SSL/TLS version. case context::sslv23: diff --git a/boost/asio/ssl/stream.hpp b/boost/asio/ssl/stream.hpp index 005ff465f4..1acaceea45 100644 --- a/boost/asio/ssl/stream.hpp +++ b/boost/asio/ssl/stream.hpp @@ -635,7 +635,8 @@ public: * * @note The async_write_some operation may not transmit all of the data to * the peer. Consider using the @ref async_write function if you need to - * ensure that all data is written before the blocking operation completes. + * ensure that all data is written before the asynchronous operation + * completes. */ template <typename ConstBufferSequence, typename WriteHandler> BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, diff --git a/boost/asio/thread_pool.hpp b/boost/asio/thread_pool.hpp index e959a645c6..ac5f00d091 100644 --- a/boost/asio/thread_pool.hpp +++ b/boost/asio/thread_pool.hpp @@ -33,7 +33,7 @@ namespace asio { * * @par Submitting tasks to the pool * - * To submit functions to the io_context, use the @ref boost::asio::dispatch, + * To submit functions to the thread_pool, use the @ref boost::asio::dispatch, * @ref boost::asio::post or @ref boost::asio::defer free functions. * * For example: diff --git a/boost/asio/use_future.hpp b/boost/asio/use_future.hpp index b2d65a6d0c..01fb2760f3 100644 --- a/boost/asio/use_future.hpp +++ b/boost/asio/use_future.hpp @@ -16,8 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/future.hpp> -#if defined(BOOST_ASIO_HAS_STD_FUTURE) \ +#if defined(BOOST_ASIO_HAS_STD_FUTURE_CLASS) \ || defined(GENERATING_DOCUMENTATION) #include <memory> @@ -155,7 +156,7 @@ __declspec(selectany) use_future_t<> use_future; #include <boost/asio/impl/use_future.hpp> -#endif // defined(BOOST_ASIO_HAS_STD_FUTURE) +#endif // defined(BOOST_ASIO_HAS_STD_FUTURE_CLASS) // || defined(GENERATING_DOCUMENTATION) #endif // BOOST_ASIO_USE_FUTURE_HPP diff --git a/boost/asio/version.hpp b/boost/asio/version.hpp index f7a02913c3..bedf15bd0c 100644 --- a/boost/asio/version.hpp +++ b/boost/asio/version.hpp @@ -18,6 +18,6 @@ // BOOST_ASIO_VERSION % 100 is the sub-minor version // BOOST_ASIO_VERSION / 100 % 1000 is the minor version // BOOST_ASIO_VERSION / 100000 is the major version -#define BOOST_ASIO_VERSION 101201 // 1.12.1 +#define BOOST_ASIO_VERSION 101202 // 1.12.2 #endif // BOOST_ASIO_VERSION_HPP diff --git a/boost/asio/write.hpp b/boost/asio/write.hpp index 50095dbdf7..e3f4d09cb7 100644 --- a/boost/asio/write.hpp +++ b/boost/asio/write.hpp @@ -33,7 +33,8 @@ namespace asio { /** * @defgroup write boost::asio::write * - * @brief Write a certain amount of data to a stream before returning. + * @brief The @c write function is a composed operation that writes a certain + * amount of data to a stream before returning. */ /*@{*/ @@ -533,8 +534,8 @@ std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b, /** * @defgroup async_write boost::asio::async_write * - * @brief Start an asynchronous operation to write a certain amount of data to a - * stream. + * @brief The @c async_write function is a composed asynchronous operation that + * writes a certain amount of data to a stream before completion. */ /*@{*/ diff --git a/boost/asio/write_at.hpp b/boost/asio/write_at.hpp index 766a8e89c4..6330214bd3 100644 --- a/boost/asio/write_at.hpp +++ b/boost/asio/write_at.hpp @@ -33,7 +33,8 @@ namespace asio { /** * @defgroup write_at boost::asio::write_at * - * @brief Write a certain amount of data at a specified offset before returning. + * @brief The @c write_at function is a composed operation that writes a + * certain amount of data at a specified offset before returning. */ /*@{*/ @@ -393,8 +394,9 @@ std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, /** * @defgroup async_write_at boost::asio::async_write_at * - * @brief Start an asynchronous operation to write a certain amount of data at - * the specified offset. + * @brief The @c async_write_at function is a composed asynchronous operation + * that writes a certain amount of data at the specified offset before + * completion. */ /*@{*/ |