diff --git a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/README b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/README index 8a91d93..a030c23 100644 --- a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/README +++ b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/README @@ -1,4 +1,4 @@ -asio version 1.13.0 -Released Tuesday, 12 March 2019. +asio version 1.14.0 +Released Sunday, 14 April 2019. See doc/index.html for API documentation and a tutorial. diff --git a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/configure.ac b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/configure.ac index e7cd3d1..2e20b84 100644 --- a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/configure.ac +++ b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(asio, [1.13.0]) +AC_INIT(asio, [1.14.0]) AC_CONFIG_SRCDIR(include/asio.hpp) AM_MAINTAINER_MODE AM_INIT_AUTOMAKE([tar-ustar]) diff --git a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/io_object_impl.hpp b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/io_object_impl.hpp index 4280fb8..6f57b66 100644 --- a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/io_object_impl.hpp +++ b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/io_object_impl.hpp @@ -24,8 +24,34 @@ #include "asio/detail/push_options.hpp" namespace asio { + +class executor; + namespace detail { +inline bool is_native_io_executor(const io_context::executor_type&) +{ + return true; +} + +template +inline bool is_native_io_executor(const Executor&, + typename enable_if::value>::type* = 0) +{ + return false; +} + +template +inline bool is_native_io_executor(const Executor& ex, + typename enable_if::value>::type* = 0) +{ +#if !defined (ASIO_NO_TYPEID) + return ex.target_type() == typeid(io_context::executor_type); +#else // !defined (ASIO_NO_TYPEID) + return false; +#endif // !defined (ASIO_NO_TYPEID) +} + template class io_object_impl @@ -46,8 +72,7 @@ public: // Construct an I/O object using an executor. explicit io_object_impl(const executor_type& ex) : service_(&asio::use_service(ex.context())), - implementation_executor_(ex, - is_same::value) + implementation_executor_(ex, (is_native_io_executor)(ex)) { service_->construct(implementation_); } @@ -68,9 +93,7 @@ public: // Move-construct an I/O object. io_object_impl(io_object_impl&& other) : service_(&other.get_service()), - implementation_executor_( - ASIO_MOVE_CAST(implementation_executor_type)( - other.implementation_executor_)) + implementation_executor_(other.get_implementation_executor()) { service_->move_construct(implementation_, other.implementation_); } diff --git a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/reactive_socket_accept_op.hpp b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/reactive_socket_accept_op.hpp index 59aaf5f..e4e5fd7 100644 --- a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/reactive_socket_accept_op.hpp +++ b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/reactive_socket_accept_op.hpp @@ -151,8 +151,10 @@ private: template class reactive_socket_move_accept_op : - private Protocol::socket, - public reactive_socket_accept_op_base + private Protocol::socket::template rebind_executor::other, + public reactive_socket_accept_op_base< + typename Protocol::socket::template rebind_executor::other, + Protocol> { public: ASIO_DEFINE_HANDLER_PTR(reactive_socket_move_accept_op); @@ -161,8 +163,8 @@ public: socket_type socket, socket_ops::state_type state, const Protocol& protocol, typename Protocol::endpoint* peer_endpoint, Handler& handler, const IoExecutor& io_ex) - : Protocol::socket(peer_io_ex), - reactive_socket_accept_op_base( + : peer_socket_type(peer_io_ex), + reactive_socket_accept_op_base( socket, state, *this, protocol, peer_endpoint, &reactive_socket_move_accept_op::do_complete), handler_(ASIO_MOVE_CAST(Handler)(handler)), @@ -194,9 +196,9 @@ public: // to ensure that any owning sub-object remains valid until after we have // deallocated the memory here. detail::move_binder2 + asio::error_code, peer_socket_type> handler(0, ASIO_MOVE_CAST(Handler)(o->handler_), o->ec_, - ASIO_MOVE_CAST(typename Protocol::socket)(*o)); + ASIO_MOVE_CAST(peer_socket_type)(*o)); p.h = asio::detail::addressof(handler.handler_); p.reset(); @@ -211,6 +213,9 @@ public: } private: + typedef typename Protocol::socket::template + rebind_executor::other peer_socket_type; + Handler handler_; IoExecutor io_executor_; }; diff --git a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/win_global.hpp b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/win_global.hpp index b2036e7..2d5ce75 100644 --- a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/win_global.hpp +++ b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/win_global.hpp @@ -35,7 +35,7 @@ struct win_global_impl static win_global_impl instance_; static static_mutex mutex_; - static T* ptr_; + T* ptr_; static tss_ptr tss_ptr_; }; @@ -45,9 +45,6 @@ win_global_impl win_global_impl::instance_ = { 0 }; template static_mutex win_global_impl::mutex_ = ASIO_STATIC_MUTEX_INIT; -template -T* win_global_impl::ptr_ = 0; - template tss_ptr win_global_impl::tss_ptr_; @@ -58,9 +55,9 @@ T& win_global() { win_global_impl::mutex_.init(); static_mutex::scoped_lock lock(win_global_impl::mutex_); - if (win_global_impl::ptr_ == 0) - win_global_impl::ptr_ = new T; - win_global_impl::tss_ptr_ = win_global_impl::ptr_; + if (win_global_impl::instance_.ptr_ == 0) + win_global_impl::instance_.ptr_ = new T; + win_global_impl::tss_ptr_ = win_global_impl::instance_.ptr_; } return *win_global_impl::tss_ptr_; diff --git a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/win_iocp_socket_accept_op.hpp b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/win_iocp_socket_accept_op.hpp index abd9b28..c7da5c1 100644 --- a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/win_iocp_socket_accept_op.hpp +++ b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/detail/win_iocp_socket_accept_op.hpp @@ -262,9 +262,9 @@ public: // to ensure that any owning sub-object remains valid until after we have // deallocated the memory here. detail::move_binder2 + asio::error_code, peer_socket_type> handler(0, ASIO_MOVE_CAST(Handler)(o->handler_), ec, - ASIO_MOVE_CAST(typename Protocol::socket)(o->peer_)); + ASIO_MOVE_CAST(peer_socket_type)(o->peer_)); p.h = asio::detail::addressof(handler.handler_); p.reset(); @@ -279,10 +279,13 @@ public: } private: + typedef typename Protocol::socket::template + rebind_executor::other peer_socket_type; + win_iocp_socket_service_base& socket_service_; socket_type socket_; socket_holder new_socket_; - typename Protocol::socket peer_; + peer_socket_type peer_; Protocol protocol_; typename Protocol::endpoint* peer_endpoint_; unsigned char output_buffer_[(sizeof(sockaddr_storage_type) + 16) * 2]; diff --git a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/version.hpp b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/version.hpp index cdd175f..e8a6c27 100644 --- a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/version.hpp +++ b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/include/asio/version.hpp @@ -18,6 +18,6 @@ // ASIO_VERSION % 100 is the sub-minor version // ASIO_VERSION / 100 % 1000 is the minor version // ASIO_VERSION / 100000 is the major version -#define ASIO_VERSION 101300 // 1.13.0 +#define ASIO_VERSION 101400 // 1.14.0 #endif // ASIO_VERSION_HPP diff --git a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/src/doc/history.qbk b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/src/doc/history.qbk index 3dedb9d..a85e608 100644 --- a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/src/doc/history.qbk +++ b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/src/doc/history.qbk @@ -7,6 +7,21 @@ [section:history Revision History] +[heading Asio 1.14.0] + +* Improved I/O object performance by adding runtime detection of native I/O + executors when using the polymorphic executor wrapper. + +* Changed I/O object move constructors so that the executor is copied, not + moved. This ensures that the moved-from I/O object is left in the same state + as if constructed with a valid executor but without a resource. + +* On Windows, fixed an issue where global object destructors were not being + run. + +* Fixed move-based `async_accept` between sockets with different executor + types. + [heading Asio 1.13.0] * Added custom I/O executor support to I/O objects. diff --git a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/src/tests/unit/ip/tcp.cpp b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/src/tests/unit/ip/tcp.cpp index 1ec7015..df45d5f 100644 --- a/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/src/tests/unit/ip/tcp.cpp +++ b/Sources/OpenVPNAdapter/Libraries/Vendors/asio/asio/src/tests/unit/ip/tcp.cpp @@ -729,6 +729,17 @@ struct move_accept_handler private: move_accept_handler(const move_accept_handler&) {} }; + +struct move_accept_ioc_handler +{ + move_accept_ioc_handler() {} + void operator()(const asio::error_code&, + asio::basic_stream_socket) {} + move_accept_ioc_handler(move_accept_handler&&) {} +private: + move_accept_ioc_handler(const move_accept_handler&) {} +}; #endif // defined(ASIO_HAS_MOVE) void test() @@ -913,8 +924,12 @@ void test() #if defined(ASIO_HAS_MOVE) acceptor1.async_accept(move_accept_handler()); acceptor1.async_accept(ioc, move_accept_handler()); + acceptor1.async_accept(ioc_ex, move_accept_handler()); + acceptor1.async_accept(ioc_ex, move_accept_ioc_handler()); acceptor1.async_accept(peer_endpoint, move_accept_handler()); acceptor1.async_accept(ioc, peer_endpoint, move_accept_handler()); + acceptor1.async_accept(ioc_ex, peer_endpoint, move_accept_handler()); + acceptor1.async_accept(ioc_ex, peer_endpoint, move_accept_ioc_handler()); #endif // defined(ASIO_HAS_MOVE) } catch (std::exception&)