Commit Graph

2567 Commits

Author SHA1 Message Date
Christopher Kohlhoff
c47c05ad31 Regenerate documentation. 2019-03-06 21:30:54 +11:00
Christopher Kohlhoff
265e75cdbb Define ASIO_STANDALONE automatically if C++11 or later is detected.
Users should define ASIO_ENABLE_BOOST to explicitly disable standalone
mode when compiling with C++11 or later.
2019-03-06 21:14:13 +11:00
Christopher Kohlhoff
189a5b1453 Update composed operations examples to use async_initiate and a new helper function async_compose. 2019-03-06 21:14:13 +11:00
Christopher Kohlhoff
296216a122 Fix handler tracking arguments in io_context implementation. 2019-03-05 17:30:00 +11:00
Christopher Kohlhoff
b823ee0954 Only enable <atomic> for the most recent Xcode clang version. 2019-03-03 19:40:27 +11:00
Christopher Kohlhoff
54c93f73e7 Fix cross references. 2019-03-03 19:40:27 +11:00
Christopher Kohlhoff
32c9da2551 Fix typo in basic_stream_socket documentation. 2019-03-03 19:40:27 +11:00
Christopher Kohlhoff
66095aa1f2 Add new DynamicBuffer_v2 which is CopyConstructible.
This change adds a new set of type requirements for dynamic buffers,
DynamicBuffer_v2, which supports copy construction. These new type
requirements enable dynamic buffers to be used as arguments to
user-defined composed operations, where the same dynamic buffer object
is used repeatedly for multiple underlying operations. For example:

  template <typename DynamicBuffer>
  void echo_line(tcp::socket& sock, DynamicBuffer buf)
  {
    n = asio::read_until(sock, buf, '\n');
    asio::write(sock, buf, asio::transfer_exactly(n));
  }

The original DynamicBuffer type requirements have been renamed to
DynamicBuffer_v1.

New type traits is_dynamic_buffer_v1 and is_dynamic_buffer_v2 have been
added to test for conformance to DynamicBuffer_v1 and DynamicBuffer_v2
respectively. The existing is_dynamic_buffer trait has been retained and
delegates to is_dynamic_buffer_v1, unless ASIO_NO_DYNAMIC_BUFFER_V1 is
defined, in which case it delegates to is_dynamic_buffer_v2.

The dynamic_string_buffer and dynamic_vector buffer classes conform to
both DynamicBuffer_v1 and DynamicBuffer_v2 requirements.

When ASIO_NO_DYNAMIC_BUFFER_V1 is defined, all support for
DynamicBuffer_v1 types and functions is #ifdef-ed out. Support for using
basic_streambuf with the read, async_read, read_until, async_read_until,
write, and async_write functions is also disabled as a consequence.

This change should have no impact on existing source code that simply
uses dynamic buffers in conjunction with asio's composed operations,
such as:

  string data;
  // ...
  size_t n = asio::read_until(my_socket
      asio::dynamic_buffer(data, MY_MAX),
      '\n');
2019-03-03 19:40:27 +11:00
Christopher Kohlhoff
d1a23c75b7 Use <atomic> when targeting apple/clang/libc++, even for C++03.
Fixes a warning about the deprecation of OSMemoryBarrier.
2019-03-02 22:33:17 +11:00
Christopher Kohlhoff
c585bdf3c9 Reduce number of copies of I/O executor. 2019-03-02 13:07:45 +11:00
Christopher Kohlhoff
5d9d01729d Move rather than copy buffers when moving a composed operation implementation. 2019-03-02 13:07:45 +11:00
Christopher Kohlhoff
2c7d26454b 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 09:56:14 +11:00
Christopher Kohlhoff
93337cba7b Add a fallback error code for when we get SSL_ERROR_SYSCALL without an associated error. 2019-03-02 08:44:03 +11:00
Christopher Kohlhoff
760e12ae22 Exclude implementation details from documentation. 2019-03-01 19:36:52 +11:00
Christopher Kohlhoff
0557b6ddf0 Fix parameter documentation in basic_object_handle constructor. 2019-03-01 19:36:19 +11:00
Christopher Kohlhoff
dc477ae51a Add ip::resolver_base to quick reference and cross reference it from ip::basic_resolver. 2019-03-01 19:02:37 +11:00
Christopher Kohlhoff
0a6bcd89bb Suppress eof on shutdown as it actually indicates success. 2019-03-01 17:22:39 +11:00
Christopher Kohlhoff
57b2ef19b0 Ensure SSL handshake errors are propagated to the peer. 2019-03-01 16:13:25 +11:00
Christopher Kohlhoff
93104538f6 Add noexcept to buffer_sequence_begin/end. 2019-03-01 09:59:31 +11:00
Christopher Kohlhoff
7c7a2555b0 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-01 09:52:06 +11:00
Christopher Kohlhoff
fff63d15a7 Add a make_strand function.
The make_strand function creates a strand with a deduced Executor template
argument.
2019-03-01 08:58:38 +11:00
Christopher Kohlhoff
52eef463ef Remove experimental directory from documentation processing. 2019-03-01 08:25:42 +11:00
Christopher Kohlhoff
2b18f00f48 Fix long line. 2019-02-28 12:46:06 +11:00
Christopher Kohlhoff
536df5fd74 Deduce EndpointSequence iterator type. 2019-02-28 12:46:06 +11:00
Christopher Kohlhoff
bc7e0f38cf Fix calculation of absolute timeout when using pthread_cond_timedwait. 2019-02-28 10:50:27 +11:00
Christopher Kohlhoff
30e38527a4 Capture port by value to prevent dangling reference. 2019-02-28 10:33:48 +11:00
Christopher Kohlhoff
2ee7a65253 Add network_v[46].hpp headers to top-level convenience header. 2019-02-28 10:18:17 +11:00
Christopher Kohlhoff
1c9a4ac338 Allow visibility pragmas to be disabled by defining 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 10:14:38 +11:00
JackBurton79
38d3fc09ab Add -lnetwork to LDFLAGS when building for Haiku OS. 2019-02-28 10:07:31 +11:00
JackBurton79
0616f498bf Include unistd.h when targeting Haiku OS. 2019-02-28 10:07:03 +11:00
MiguelCompany
a10d3595eb Also set SO_REUSEPORT on QNX to correctly enable multicast. 2019-02-28 10:03:56 +11:00
Zyrin
555ed6c993 Return correct number of bytes transferred when datagram truncation occurs. 2019-02-28 09:50:05 +11:00
Cristian Morales Vega
3b0daafa0b Make the executor_work_guard move constructor noexcept. 2019-02-28 09:49:58 +11:00
Christopher Kohlhoff
1a7b0c7220 Don't allow thread_pool locking to be set by ASIO_CONCURRENCY_HINT_ macros.
Conservatively prevent the thread_pool's internal locking behaviour from
being changed via the 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 09:39:57 +11:00
Christopher Kohlhoff
51274de46a Update list of unit tests in MSVC makefile. 2019-02-27 21:56:14 +11:00
Christopher Kohlhoff
4e49b8c3e5 Disambiguate enable_if and native_handle_type. 2019-02-27 21:56:14 +11:00
Christopher Kohlhoff
ea67e69e3a Repeat typedefs in derived class templates to fix gcc compile error on Windows. 2019-02-27 21:56:14 +11:00
Christopher Kohlhoff
490743a662 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-27 21:56:14 +11:00
abbyssoul
171a02ed0d Added constructor for local::basic_endpoint from string_view 2019-02-24 11:07:00 -10:00
Christopher Kohlhoff
6f40eb3155 Add noexcept qualifier to ip::basic_endpoint class. 2019-02-24 10:41:02 -10:00
Christopher Kohlhoff
3b4bf13bd1 Add noexcept qualifier to ip::address_v6 class. 2019-02-24 10:30:12 -10:00
Christopher Kohlhoff
b5b9717ed6 Add noexcept qualifier to ip::address_v4 class. 2019-02-24 10:20:27 -10:00
Christopher Kohlhoff
39993b3ec2 Add noexcept qualifier to ip::address class. 2019-02-24 07:19:41 -10:00
Christopher Kohlhoff
e7b397142a Update windows::overlapped_ptr to support custom I/O executors. 2019-02-21 14:49:25 +11:00
Christopher Kohlhoff
84e9a48ae6 Fix completion signatures used for ssl::stream's async_handshake and async_shutdown. 2019-02-18 19:09:44 -10:00
Christopher Kohlhoff
24e92ea209 Change archetype completion token's handler to require exact signature. 2019-02-18 19:08:35 -10:00
Christopher Kohlhoff
498dab4662 Fix compile error in serialization example. 2019-02-17 19:50:30 -10:00
Christopher Kohlhoff
62c4488abc 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 18:49:54 -10:00
Christopher Kohlhoff
fc05ce407c Remove deprecated handler_type and single-argument async_result. 2019-02-17 18:16:31 -10:00
Christopher Kohlhoff
f9e4489b57 Update copyright notices. 2019-02-17 18:16:31 -10:00