mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2024-10-06 09:12:08 +08:00
Squashed 'Sources/OpenVPNAdapter/Libraries/Vendors/asio/' changes from 90f32660cd..8d4c8c3ce4
8d4c8c3ce4 asio version 1.14.0 released 30336a0873 Revision history. 2a1f68845a On Windows, ensure global object destructors are run. 6f55aeecd0 Fix move-based async_accept between sockets with different executor types. c1c068c6ad The executor is copied, not moved, when the I/O object moves. 37c8d91d21 Add runtime detection of native I/O executors when using polymorphic wrapper. git-subtree-dir: Sources/OpenVPNAdapter/Libraries/Vendors/asio git-subtree-split: 8d4c8c3ce43c866f609d2eda9a43fe5b334620be
This commit is contained in:
parent
9ec9e579e9
commit
f44694ce5f
@ -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.
|
||||
|
@ -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])
|
||||
|
@ -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 <typename Executor>
|
||||
inline bool is_native_io_executor(const Executor&,
|
||||
typename enable_if<!is_same<Executor, executor>::value>::type* = 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Executor>
|
||||
inline bool is_native_io_executor(const Executor& ex,
|
||||
typename enable_if<is_same<Executor, executor>::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 <typename IoObjectService,
|
||||
typename Executor = io_context::executor_type>
|
||||
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<IoObjectService>(ex.context())),
|
||||
implementation_executor_(ex,
|
||||
is_same<Executor, io_context::executor_type>::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_);
|
||||
}
|
||||
|
@ -151,8 +151,10 @@ private:
|
||||
template <typename Protocol, typename PeerIoExecutor,
|
||||
typename Handler, typename IoExecutor>
|
||||
class reactive_socket_move_accept_op :
|
||||
private Protocol::socket,
|
||||
public reactive_socket_accept_op_base<typename Protocol::socket, Protocol>
|
||||
private Protocol::socket::template rebind_executor<PeerIoExecutor>::other,
|
||||
public reactive_socket_accept_op_base<
|
||||
typename Protocol::socket::template rebind_executor<PeerIoExecutor>::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<typename Protocol::socket, Protocol>(
|
||||
: peer_socket_type(peer_io_ex),
|
||||
reactive_socket_accept_op_base<peer_socket_type, Protocol>(
|
||||
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<Handler,
|
||||
asio::error_code, typename Protocol::socket>
|
||||
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<PeerIoExecutor>::other peer_socket_type;
|
||||
|
||||
Handler handler_;
|
||||
IoExecutor io_executor_;
|
||||
};
|
||||
|
@ -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<T> tss_ptr_;
|
||||
};
|
||||
|
||||
@ -45,9 +45,6 @@ win_global_impl<T> win_global_impl<T>::instance_ = { 0 };
|
||||
template <typename T>
|
||||
static_mutex win_global_impl<T>::mutex_ = ASIO_STATIC_MUTEX_INIT;
|
||||
|
||||
template <typename T>
|
||||
T* win_global_impl<T>::ptr_ = 0;
|
||||
|
||||
template <typename T>
|
||||
tss_ptr<T> win_global_impl<T>::tss_ptr_;
|
||||
|
||||
@ -58,9 +55,9 @@ T& win_global()
|
||||
{
|
||||
win_global_impl<T>::mutex_.init();
|
||||
static_mutex::scoped_lock lock(win_global_impl<T>::mutex_);
|
||||
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_;
|
||||
if (win_global_impl<T>::instance_.ptr_ == 0)
|
||||
win_global_impl<T>::instance_.ptr_ = new T;
|
||||
win_global_impl<T>::tss_ptr_ = win_global_impl<T>::instance_.ptr_;
|
||||
}
|
||||
|
||||
return *win_global_impl<T>::tss_ptr_;
|
||||
|
@ -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<Handler,
|
||||
asio::error_code, typename Protocol::socket>
|
||||
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<PeerIoExecutor>::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];
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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<asio::ip::tcp,
|
||||
asio::io_context::executor_type>) {}
|
||||
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&)
|
||||
|
Loading…
Reference in New Issue
Block a user