Commit Graph

2567 Commits

Author SHA1 Message Date
Christopher Kohlhoff
317895870d Minor documentation fixes. 2019-12-02 20:53:37 +11:00
Christopher Kohlhoff
df63c9585e More typenames required in ssl::stream. 2019-12-02 20:33:06 +11:00
Christopher Kohlhoff
8087252a0c Add noexcept qualifier to socket move constructors. 2019-11-06 08:32:06 +11:00
Christopher Kohlhoff
dd2243322b Require that Endpoint default constructor and move operations never throw. 2019-11-06 08:32:01 +11:00
Christopher Kohlhoff
35d12b3bfc Require that Protocol copy and move operations never throw. 2019-11-06 08:31:57 +11:00
Christopher Kohlhoff
70b0c5f3e4 Add noexcept qualifier to protocol accessors. 2019-11-06 06:33:35 +11:00
Christopher Kohlhoff
b317c8be09 Add typename to ssl::stream's initiation objects' executor_type typedefs. 2019-11-06 06:32:51 +11:00
Christopher Kohlhoff
0930d76385 Ensure the executor type is propagated to newly accepted sockets.
When synchronously or asynchronously accepting a new connection, but
without specifying an executor or execution context, the accept
operation will now correctly propagate the executor type from the
acceptor to the socket. For example, if your acceptor type is:

  basic_socket_acceptor<ip::tcp, my_executor_type>

then your accepted socket type will be:

  basic_stream_socket<ip::tcp, my_executor_type>
2019-10-31 20:19:31 +11:00
Christopher Kohlhoff
ddfa5f9d70 Add default completion tokens.
Every I/O executor type now has an associated default completion token
type. This is specified via the `default_completion_token` trait. This
trait may be used in asynchronous operation declarations as follows:

  template <
      typename IoObject,
      typename CompletionToken =
        typename default_completion_token<
          typename IoObject::executor_type
        >::type
    >
  auto async_foo(
      IoObject& io_object,
      CompletionToken&& token =
        typename default_completion_token<
          typename IoObject::executor_type
        >::type{}
    );

If not specialised, this trait type is `void`, meaning no default
completion token type is available for the given I/O executor.

The `default_completion_token` trait is specialised for the
`use_awaitable` completion token so that it may be used as shown in the
following example:

  auto socket = use_awaitable.as_default_on(tcp::socket(my_context));
  // ...
  co_await socket.async_connect(my_endpoint); // Defaults to use_awaitable.

In this example, type of the `socket` object is transformed from
`tcp::socket` to have an I/O executor with the default completion token
set to `use_awaitable`.

Alternatively, the socket type may be computed directly:

  using tcp_socket = use_awaitable_t<>::as_default_on_t<tcp::socket>;
  tcp_socket socket(my_context);
  // ...
  co_await socket.async_connect(my_endpoint); // Defaults to use_awaitable.
2019-10-31 20:18:46 +11:00
Christopher Kohlhoff
ca229e264a Use async_initiate in Windows-specific I/O objects. 2019-10-30 19:14:01 +11:00
Christopher Kohlhoff
5b126e3845 Add executor_type/get_executor to all initiation objects.
The asynchronous operations' initiation function objects now report
their associated I/O executor via the nested type `executor_type` and
member function `get_executor()`.

The presence of `executor_type` and `get_executor()` should be treated
as optional, and consequently it may be preferable to access them via
the `associated_executor` trait and the `get_associated_executor()`
helper function.
2019-10-30 19:14:01 +11:00
Christopher Kohlhoff
f681562d2d Add rebind_executor to all I/O object types.
The I/O objects provided by Asio now support the nested template type
`rebind_executor` as a way to generically rebind them to an alternative
I/O executor type. For example:

  using my_socket_type =
    tcp::socket::rebind_executor<my_executor_type>::other;
2019-10-30 19:14:01 +11:00
Christopher Kohlhoff
68d15f184c Use completion_token_for concept to constrain token parameters. 2019-10-30 19:14:00 +11:00
Christopher Kohlhoff
26207403cf Add concepts to support async_initiate.
This change introduces three new concepts:

* completion_signature<T>: Checks if T is a signature of the form R(Args...).

* completion_handler_for<T, Signature>: Checks if T is usable as a completion
  handler with the specified signature.

* completion_token_for<T, Signature>: Checks if T is a completion token that
  can be used with async_initiate and the specified signature.

For backward compatibility, use the macros ASIO_COMPLETION_SIGNATURE,
ASIO_COMPLETION_HANDLER_FOR, and ASIO_COMPLETION_TOKEN_FOR respectively.
These macros expand to `typename` when concepts are unsupported.
2019-10-30 19:14:00 +11:00
Christopher Kohlhoff
98186da7bc Use automatically deduced return types for all async operations.
C++14 or later is required to support completion tokens that use
per-operation return type deduction. For C++11 or earlier, a completion
token's async_result specialisation must still provide the nested
typedef `return_type`.
2019-10-30 19:14:00 +11:00
Christopher Kohlhoff
d830b433a8 Add automatic return type deduction to async_initiate.
Enabled for C++11 or later.
2019-10-30 19:14:00 +11:00
Christopher Kohlhoff
62aea6b207 asio version 1.14.1 released 2019-08-19 20:45:13 +10:00
Christopher Kohlhoff
0a52abce85 Regenerate documentation. 2019-08-19 19:42:22 +10:00
Christopher Kohlhoff
855e80ac6a Revision history. 2019-08-19 19:42:22 +10:00
Christopher Kohlhoff
b07229ca0a Require C++17 or later for coroutines TS support with clang. 2019-07-09 12:47:22 +10:00
Christopher Kohlhoff
8861491975 Ensure BOOST_VERSION tests are conditional. 2019-07-09 12:40:44 +10:00
Mike Pollard
772f53a8d8 Added wolfSSL Compatability for Asio 2019-07-09 09:55:43 +10:00
Christopher Kohlhoff
2ec993db21 Move shutdown() implementation to winrt_ssocket_service to avoid name hiding. 2019-07-09 09:55:43 +10:00
Torkel Bjørnson-Langen
d21da17f15 Minor fix in documentation for is_dynamic_buffer 2019-07-09 09:55:43 +10:00
Zoltán Mizsei
ebb5d76a24 Preliminary Haiku support 2019-07-09 09:55:43 +10:00
Christopher Kohlhoff
a4a7335250 Serial port get_option() should be const. 2019-07-09 09:55:43 +10:00
Christopher Kohlhoff
6cec63e8a6 Fix warnings about incompatible pointer cast when obtaining CancelIoEx entry point. 2019-07-09 09:55:43 +10:00
Christopher Kohlhoff
734e339d3f Fix is_*_buffer_sequence detection for user-defined sequence types. 2019-07-09 09:55:43 +10:00
Christopher Kohlhoff
d2804e5121 Set defaults when opening a serial port on Windows. 2019-07-09 09:55:43 +10:00
Christopher Kohlhoff
6b53692806 Fix doxygen generation in tutorial. 2019-07-09 09:55:43 +10:00
Christopher Kohlhoff
ebefe37003 Annotate case fall-through in connect() implementation. 2019-07-09 09:55:43 +10:00
Christopher Kohlhoff
e03aca35f1 Eliminate a redundant move construction when completed handlers are dispatched. 2019-07-09 09:55:43 +10:00
Christopher Kohlhoff
8d4c8c3ce4 asio version 1.14.0 released 2019-07-09 09:55:21 +10:00
Christopher Kohlhoff
30336a0873 Revision history. 2019-07-09 09:54:44 +10:00
Christopher Kohlhoff
2a1f68845a On Windows, ensure global object destructors are run. 2019-03-25 13:13:19 +11:00
Christopher Kohlhoff
6f55aeecd0 Fix move-based async_accept between sockets with different executor types. 2019-03-25 10:06:04 +11:00
Christopher Kohlhoff
c1c068c6ad The executor is copied, not moved, when the I/O object moves.
The moved-from I/O object needs to be left in the same state as if
constructed with a valid executor but without a resource.
2019-03-24 18:40:10 +11:00
Christopher Kohlhoff
37c8d91d21 Add runtime detection of native I/O executors when using polymorphic wrapper. 2019-03-22 10:59:14 +11:00
Christopher Kohlhoff
90f32660cd asio version 1.13.0 released 2019-03-12 12:39:56 +11:00
Christopher Kohlhoff
eb99518b32 Remove ASIO_ENABLE_OLD_SERVICES from documentation. 2019-03-12 11:46:00 +11:00
Christopher Kohlhoff
a8d0c39c92 Revision history. 2019-03-12 09:58:18 +11:00
Christopher Kohlhoff
efac12f649 Change default _WIN32_WINNT value to 0x0601 (Windows 7). 2019-03-10 15:09:28 +11:00
Christopher Kohlhoff
5bb3cf5c61 Bump minimum MSVC version for ASIO_HAS_DECLTYPE.
Although MSVC 11.0 supports the decltype keyword, it does not operate
correctly when used in the buffer sequence detection traits. This change
fixes compile errors when trying to use the read and write composed
operations with MSVC 11.0.
2019-03-10 14:57:33 +11:00
Christopher Kohlhoff
233254304b Add more missing entries to quick reference. 2019-03-10 13:56:21 +11:00
Christopher Kohlhoff
b439f14af8 Default to standalone build unless boost is explicitly specified. 2019-03-10 13:56:21 +11:00
Christopher Kohlhoff
0b5f03b4b7 Suppress various unused variable warnings. 2019-03-07 16:04:00 +11:00
Christopher Kohlhoff
ab174ab000 Don't overwrite a failure error code from the SSL engine when doing sync I/O. 2019-03-07 15:51:23 +11:00
Christopher Kohlhoff
45abc54125 Fix up dispatch() documentation. Clarify distinction between post() and defer(). 2019-03-07 15:19:13 +11:00
Christopher Kohlhoff
c7d4557434 Add new cpp14 examples to doc. 2019-03-06 22:47:13 +11:00
Christopher Kohlhoff
b53662939f Fix template argument list bracketing. 2019-03-06 22:27:13 +11:00