Commit Graph

864 Commits

Author SHA1 Message Date
Christopher Kohlhoff
b9600df415 Completion conditions now require move rather than copy.
The CompletionCondition type requirements have been relaxed such that
they only require MoveConstructible types instead of CopyConstructible.
2019-03-02 16:12:53 +11:00
Christopher Kohlhoff
7a4f4cb90f Add a fallback error code for when we get SSL_ERROR_SYSCALL without an associated error. 2019-03-02 16:11:53 +11:00
Christopher Kohlhoff
cb335f6b2d Exclude implementation details from documentation. 2019-03-02 16:10:36 +11:00
Christopher Kohlhoff
530febded7 Fix parameter documentation in basic_object_handle constructor. 2019-03-02 16:09:50 +11:00
Christopher Kohlhoff
83278307e1 Add ip::resolver_base to quick reference and cross reference it from ip::basic_resolver. 2019-03-02 16:09:08 +11:00
Christopher Kohlhoff
1f323bb6a2 Suppress eof on shutdown as it actually indicates success. 2019-03-02 16:07:11 +11:00
Christopher Kohlhoff
2864d2bf32 Ensure SSL handshake errors are propagated to the peer. 2019-03-02 16:06:18 +11:00
Christopher Kohlhoff
94c6359604 Add noexcept to buffer_sequence_begin/end. 2019-03-02 16:05:03 +11:00
Christopher Kohlhoff
350afe1bee Prevent implicit conversion with buffer_sequence_begin/end.
This change addresses an issue where a call to buffer_sequence_begin or
buffer_sequence_end could trigger an implicit conversion to const_buffer
or mutable_buffer. Whenever this implicit conversion occurred, the
return value of buffer_sequence_begin/end would point to a temporary
object.
2019-03-02 16:03:47 +11:00
Christopher Kohlhoff
9eb153718d Add a make_strand function.
The make_strand function creates a strand with a deduced Executor template
argument.
2019-03-02 16:02:42 +11:00
Christopher Kohlhoff
154c3fe277 Fix long line. 2019-02-28 20:18:05 +11:00
Christopher Kohlhoff
4cc2856dee Deduce EndpointSequence iterator type. 2019-02-28 20:17:40 +11:00
Christopher Kohlhoff
90f1cda1d9 Fix calculation of absolute timeout when using pthread_cond_timedwait. 2019-02-28 20:16:44 +11:00
Christopher Kohlhoff
d547df309f Add network_v[46].hpp headers to top-level convenience header. 2019-02-28 20:15:26 +11:00
Christopher Kohlhoff
5b78e1b5b3 Allow visibility pragmas to be disabled by defining BOOST_ASIO_DISABLE_VISIBILITY.
Note: If symbols are hidden extra care must be taken to ensure that asio
types are not passed across shared library API boundaries.
2019-02-28 20:14:38 +11:00
Christopher Kohlhoff
2d0b996119 Include unistd.h when targeting Haiku OS. 2019-02-28 20:13:29 +11:00
Christopher Kohlhoff
f4e0e43080 Also set SO_REUSEPORT on QNX to correctly enable multicast. 2019-02-28 20:12:57 +11:00
Christopher Kohlhoff
a23ecd3a62 Return correct number of bytes transferred when datagram truncation occurs. 2019-02-28 20:12:15 +11:00
Christopher Kohlhoff
c0fa42a19b Make the executor_work_guard move constructor noexcept. 2019-02-28 20:11:40 +11:00
Christopher Kohlhoff
356750d694 Don't allow thread_pool locking to be set by BOOST_ASIO_CONCURRENCY_HINT_ macros.
Conservatively prevent the thread_pool's internal locking behaviour from
being changed via the BOOST_ASIO_CONCURRENCY_HINT_ macros, as there is
no way to use a thread_pool object in a purely single-threaded use case
anyway. This change also fixes a conversion warning.
2019-02-28 20:10:32 +11:00
Christopher Kohlhoff
0db2eb8eaa Disambiguate enable_if and native_handle_type. 2019-02-28 00:03:46 +11:00
Christopher Kohlhoff
483f3d32d6 Repeat typedefs in derived class templates to fix gcc compile error on Windows. 2019-02-28 00:03:14 +11:00
Christopher Kohlhoff
baca9a092f Promote coroutines TS support classes to asio namespace.
The awaitable<>, co_spawn(), this_coro, detached, and redirect_error
facilities have been moved from the asio::experimental namespace to
namespace asio. As part of this change, the this_coro::token() awaitable
has been superseded by the asio::use_awaitable completion token.

Please note that the use_awaitable and redirect_error completion tokens
work only with asynchronous operations that use the new form of
async_result with member function initiate(). Furthermore, when using
use_awaitable, please be aware that the asynchronous operation is not
initiated until co_await is applied to the awaitable<>.
2019-02-28 00:02:00 +11:00
Christopher Kohlhoff
522d21c616 Added constructor for local::basic_endpoint from string_view. 2019-02-27 23:51:26 +11:00
Christopher Kohlhoff
c5bffba77d Add noexcept qualifier to ip::basic_endpoint class. 2019-02-27 23:50:28 +11:00
Christopher Kohlhoff
aa4483ab0e Add noexcept qualifier to ip::address_v6 class. 2019-02-27 23:49:35 +11:00
Christopher Kohlhoff
07898cafc6 Add noexcept qualifier to ip::address_v4 class. 2019-02-27 23:49:08 +11:00
Christopher Kohlhoff
414af97664 Add noexcept qualifier to ip::address class. 2019-02-27 23:48:37 +11:00
Christopher Kohlhoff
035775462e Update windows::overlapped_ptr to support custom I/O executors. 2019-02-20 18:45:53 -10:00
Christopher Kohlhoff
e8e370c9ca Fix completion signatures used for ssl::stream's async_handshake and async_shutdown. 2019-02-18 23:07:24 -10:00
Christopher Kohlhoff
0568d3bf0b New async_result form with initiate() static member function.
The `async_result` template now supports a new form:

    template <typename CompletionToken, typename Signature>
    struct async_result
    {
      typedef /* ... */ return_type;

      template <typename Initiation,
          typename RawCompletionToken,
          typename... Args>
      static return_type initiate(
          Initiation&& initiation,
          RawCompletionToken&& token,
          Args&&... args);
    };

The `initiate()` function must:

* Transform the token into a completion handler object `handler`.

* Cause the invocation of the function object `initiation` as if
  by calling:

    std::forward<Initiation>(initiation)(
        std::move(handler),
        std::forward<Args>(args)...);

The invocation of `initiation` may be deferred (e.g. lazily evaluated),
in which case `initiation` and `args` must be decay-copied and moved
as required.

A helper function template `async_initiate` has also been added as a
wrapper for the invocation of `async_result<>::initiate`. For backward
compatibility, this function supports both the old and new async_result
forms.
2019-02-17 20:00:19 -10:00
Christopher Kohlhoff
b572bfbc21 Remove deprecated handler_type and single-argument async_result. 2019-02-17 20:00:05 -10:00
Christopher Kohlhoff
ae04c26689 Update copyright notices. 2019-02-17 19:59:39 -10:00
Christopher Kohlhoff
59066d80b2 Add custom I/O executor support to I/O objects.
All I/O objects now have an additional Executor template parameter. This
template parameter defaults to the asio::executor type (the polymorphic
executor wrapper) but can be used to specify a user-defined executor
type.

I/O objects' constructors and functions that previously took an
asio::io_context& now accept either an Executor or a reference to a
concrete ExecutionContext (such as asio::io_context or
asio::thread_pool).

One potential point of breakage in existing user code is when reusing an
I/O object's io_context for constructing another I/O object, as in:

    asio::steady_timer my_timer(my_socket.get_executor().context());

To fix this, either construct the second I/O object using the first I/O
object's executor:

    asio::steady_timer my_timer(my_socket.get_executor());

or otherwise explicitly pass the io_context:

    asio::steady_timer my_timer(my_io_context);
2019-02-17 19:59:29 -10:00
Christopher Kohlhoff
a72fbb0b86 Remove deprecated get_io_context and get_io_service functions. 2019-02-17 19:59:20 -10:00
Christopher Kohlhoff
0b2db4b84e Remove deprecated services support. 2019-02-17 19:59:01 -10:00
Christopher Kohlhoff
689a98cf84 Use separate recycled memory slot for polymorphic executor. 2019-02-17 19:58:53 -10:00
Christopher Kohlhoff
4b44dd8b59 Fix long lines. 2018-12-05 13:40:03 +11:00
Christopher Kohlhoff
2504d9ab25 Make distinction between overloads clearer. 2018-12-05 13:28:34 +11:00
Christopher Kohlhoff
486843019a Indicate replacements for deprecated overloads. 2018-12-05 13:24:35 +11:00
Christopher Kohlhoff
c4f23d5fd5 Fix brief description of buffer() overload for non-const std::string. 2018-12-05 13:23:39 +11:00
Christopher Kohlhoff
c3c769f41d Version bump. 2018-11-07 08:58:44 +11:00
Christopher Kohlhoff
1b6cd9e80c Add new header file required by previous commit. 2018-11-06 00:01:16 +11:00
Christopher Kohlhoff
84b95e1d8d Fix detection of std::future with libstdc++. 2018-11-05 23:12:24 +11:00
Christopher Kohlhoff
2e5ecdc897 Fix compile error in regex overload of read_until. 2018-11-05 23:11:48 +11:00
Christopher Kohlhoff
b9add379a7 Clear the heap index for removed timers.
Fixes timer heap corruption that can occur after move assignment of
a cancelled timer.
2018-11-05 23:11:16 +11:00
Christopher Kohlhoff
43874d5497 Fix detection of std::experimental::string_view and std::string_view with newer clang/libc++. 2018-11-05 23:10:45 +11:00
Christopher Kohlhoff
c6875a6fb3 Add compile-time test for TLSv1 presence. 2018-11-05 23:10:15 +11:00
Christopher Kohlhoff
f5ea76146f Fix macro used to test for TLS v1.2 support. 2018-11-05 23:09:46 +11:00
Christopher Kohlhoff
8b716c95b3 Fix typo in ssl::stream::async_write_some documentation. 2018-11-05 23:08:46 +11:00
Christopher Kohlhoff
0e02f7c51e Fix incorrect reference to 'io_context' in thread_pool documentation. 2018-11-05 23:08:01 +11:00
Christopher Kohlhoff
4d3833013a Fix MSVC version number for availability of std::invoke_result. 2018-11-05 23:07:28 +11:00
Christopher Kohlhoff
569cba5d47 Test language version using _MSVC_LANG rather than _HAS_CXX17. 2018-11-05 23:07:02 +11:00
Christopher Kohlhoff
5603b1f990 Update buffer sequence traits to test new requirements, if decltype is available. 2018-11-05 23:06:21 +11:00
Christopher Kohlhoff
cf0dab4026 Define buffer sequence traits after buffer_sequence_begin/end has been defined. 2018-11-05 23:05:40 +11:00
Christopher Kohlhoff
a9f264d76e Fix MSVC issue when building with exceptions disabled. 2018-11-05 23:04:39 +11:00
Christopher Kohlhoff
be95255430 Add options for TLS v1.3. 2018-11-05 23:03:56 +11:00
Christopher Kohlhoff
8cceba99e6 Prevent global objects from being created once per thread on Windows. 2018-11-05 23:00:35 +11:00
Christopher Kohlhoff
ad8cc21d59 Fix crash when using size(), max_size() or empty() on default-constructed resolver results. 2018-11-05 22:58:47 +11:00
Christopher Kohlhoff
d9a0dec854 Move the return value in basic_resolver_results::begin() to avoid copying.
This is reported as a warning by recent Clang.
2018-11-05 22:58:05 +11:00
Christopher Kohlhoff
e382407610 Don't use BOOST_VERSION macro in standalone mode. 2018-11-05 22:57:46 +11:00
Christopher Kohlhoff
f14f1f044c ASIO_HAS_DECL_TYPE should be ASIO_HAS_DECLTYPE in is_buffer_sequence.hpp. 2018-11-05 22:56:17 +11:00
Christopher Kohlhoff
1e55098569 Enable move support for the Intel Compiler. 2018-11-05 22:50:39 +11:00
Christopher Kohlhoff
38cb197197 Do not double define has_string_view with clang-cl
Clang-cl identifies both as clang and as MSVC.
This resulted in defining BOOST_ASIO_HAS_STD_STRING_VIEW twice.
2018-11-05 22:49:53 +11:00
Christopher Kohlhoff
39346ddc3d Fix handler tracking operation name for io_context::executor_type::dispatch. 2018-11-05 22:48:31 +11:00
Christopher Kohlhoff
dd3a28c9fd Fix buffer overflow when parsing an address string with a 64-bit scope id. 2018-11-05 22:47:35 +11:00
Christopher Kohlhoff
50b66f0fb3 Check for gthreads before enabling std::future with g++. 2018-04-01 21:37:04 +10:00
Christopher Kohlhoff
b61b555157 Need namespace std for sprintf. 2018-04-01 15:49:46 +10:00
Christopher Kohlhoff
158950ed64 Fix storage of decayed function and handler in spawn()-ed coroutine. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
e125aa7538 Fixed compilation on Android NDK15+. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
da95f47d6b Fix basic_yield_context support for completion signatures with reference parameters. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
b10b5f531b Explicitly ignore result of iterator dereference. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
0ffe337bda Distinguish legacy completion handlers (which must be CopyConstructible). 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
ec5c24e3cd Decay the DynamicBuffer type used in enable_if tests. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
b5b17a67f0 Use std::string_view for C++17 or later, and std::experimental::string_view for C++14.
Define the preprocessor macro BOOST_ASIO_DISABLE_STD_STRING_VIEW to
force the use of std::experimental::string_view (assuming it is
available) when compiling in C++17 mode.
2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
69a6480fc0 Use std::invoke_result with recent MSVC. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
33d4704420 Make add_certificate_authority process multiple certificates in a bundle. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
bbc5abf228 Don't call SSL_COMP_free_compression_methods if SSL_OP_NO_COMPRESSION is defined. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
c112385412 Fix typo in detail::consuming_buffers specialisation. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
4e5cdbf580 Fix basic_resolver_results::value_type typedef. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
a224cbfa7b Add missing move in ssl asynchronous operation. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
61e0ad085d Fix async_result when used with handler_type. 2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
9660e81957 Correct prepare_memfn_helper test.
Fix prepare_memfn_helper test to use intended member function
'prepare' rather than 'data' copied by mistake from previous check.
2018-04-01 15:28:38 +10:00
Christopher Kohlhoff
5672713c90 Change socket iostreams to use chrono by default.
Define BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM to enable the
old Boost.Date_Time interface in basic_socket_streambuf and
basic_socket_iostream.
2018-04-01 15:28:37 +10:00
Christopher Kohlhoff
c30ed33c5e Ignore operations posted to a strand during shutdown. 2018-03-12 22:32:35 +11:00
Christopher Kohlhoff
dbccc3beea Fix redirect_error to work with non-const error_codes. 2018-03-12 22:25:17 +11:00
Christopher Kohlhoff
1b61364239 Add missing include of <sys/timerfd.h>. 2018-03-09 20:59:09 +11:00
Christopher Kohlhoff
30b047b1e6 Ensure all coroutine layers are correctly attached to the 'stack'. 2018-03-09 20:57:53 +11:00
Christopher Kohlhoff
41ef7c48df Version bump. 2018-03-07 17:30:08 +11:00
Christopher Kohlhoff
95129f34ca Fix spurious resumption. 2018-03-06 22:19:51 +11:00
Christopher Kohlhoff
9b45abcbff Restrict the types that may be awaited. 2018-03-06 07:32:47 +11:00
Christopher Kohlhoff
97b11c49b7 Fix MSVC compile error. 2018-03-06 07:30:44 +11:00
Christopher Kohlhoff
f7222d0866 Fix namespace qualification issues. 2018-03-05 23:00:10 +11:00
Christopher Kohlhoff
37d49a4f68 Allow the awaitable to be stored and co_await applied to it later. 2018-03-05 22:50:26 +11:00
Christopher Kohlhoff
9cb2eba353 Use memory recycling for awaitees. 2018-03-05 22:48:22 +11:00
Christopher Kohlhoff
c989109489 Fix up make_work_guard ambiguity. 2018-03-04 23:09:04 +11:00
Christopher Kohlhoff
deb02f7a69 Add convenience header for experimental features. 2018-03-04 23:09:04 +11:00
Christopher Kohlhoff
b30dfe8224 Add new experimental::co_spawn function. 2018-03-04 23:09:04 +11:00
Christopher Kohlhoff
142222c0e6 Add new experimental::redirect_error completion token type. 2018-03-04 22:06:55 +11:00
Christopher Kohlhoff
169d1d8cef Add new experimental::detached_t completion token type. 2018-03-04 22:06:12 +11:00