Commit Graph

1359 Commits

Author SHA1 Message Date
Christopher Kohlhoff
2f38e7ab87 Merge asio 1.16.0 from 'develop'. 2019-12-05 14:55:27 +11:00
Christopher Kohlhoff
95f7e93635 Version bump. 2019-12-05 00:34:58 +11:00
Christopher Kohlhoff
5b6dc5ba74 Update diagrams to use io_context rather than io_service. 2019-12-05 00:34:39 +11:00
Christopher Kohlhoff
4bb5257f45 Revision history. 2019-12-05 00:18:44 +11:00
Christopher Kohlhoff
ffa958f1f4 Regenerate documentation. 2019-12-04 23:47:31 +11:00
Christopher Kohlhoff
6f0c944895 Fix cross referencing for InnerExecutor template parameters. 2019-12-04 23:40:58 +11:00
Christopher Kohlhoff
81dc9a91c2 Documentation for default completion tokens. 2019-12-04 23:40:58 +11:00
Christopher Kohlhoff
f74937cdd6 Don't specify default token on some async_write overloads.
Eliminates an ambiguity.
2019-12-03 20:13:24 +11:00
Christopher Kohlhoff
dfc8da28c1 Start handler work again in case of restarting accept operation. 2019-12-03 20:12:53 +11:00
Christopher Kohlhoff
a69af4d982 Specify default baud rate when opening serial port on Windows. 2019-12-03 20:10:04 +11:00
Christopher Kohlhoff
2c29ad2e98 Fix constant used to initialise the serial port RTS control flag on Windows. 2019-12-03 20:06:48 +11:00
Christopher Kohlhoff
5225384b4d Use feature-test macro for detecting return type deduction. 2019-12-03 20:06:15 +11:00
Christopher Kohlhoff
0cb51946bb Minor documentation fixes. 2019-12-03 19:59:09 +11:00
Christopher Kohlhoff
37c6a4cea5 More typenames required in ssl::stream. 2019-12-03 19:57:37 +11:00
Christopher Kohlhoff
9254ec55a3 Merge asio from 'develop'. 2019-11-07 09:08:05 +11:00
Christopher Kohlhoff
b6c27b9c31 Add noexcept qualifier to socket move constructors. 2019-11-06 21:13:26 +11:00
Christopher Kohlhoff
6e49032917 Require that Endpoint default constructor and move operations never throw. 2019-11-06 21:13:26 +11:00
Christopher Kohlhoff
244f0c3e8c Require that Protocol copy and move operations never throw. 2019-11-06 21:00:20 +11:00
Christopher Kohlhoff
ab97085e81 Add noexcept qualifier to protocol accessors. 2019-11-06 20:58:27 +11:00
Christopher Kohlhoff
529ce8dec4 Add typename to ssl::stream's initiation objects' executor_type typedefs. 2019-11-06 20:57:47 +11:00
Christopher Kohlhoff
ec698a95f5 Merge asio from 'develop'. 2019-10-31 17:39:05 +11:00
Christopher Kohlhoff
7b0b56b702 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-30 20:53:18 +11:00
Christopher Kohlhoff
8e0762de49 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_type` trait.
This trait may be used in asynchronous operation declarations as
follows:

  template <
      typename IoObject,
      typename CompletionToken =
        typename default_completion_token_type<
          typename IoObject::executor_type
        >::type
    >
  auto async_foo(
      IoObject& io_object,
      CompletionToken&& token =
        typename default_completion_token_type<
          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_type` 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-30 20:51:58 +11:00
Christopher Kohlhoff
ab27d55ef2 Use async_initiate in Windows-specific I/O objects. 2019-10-30 20:49:47 +11:00
Christopher Kohlhoff
935dad16cb 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 20:48:15 +11:00
Christopher Kohlhoff
b9dce65df6 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 20:46:29 +11:00
Christopher Kohlhoff
72ca8370ed Use completion_token_for concept to constrain token parameters. 2019-10-30 20:45:38 +11:00
Christopher Kohlhoff
ac6f944f72 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 BOOST_ASIO_COMPLETION_SIGNATURE,
BOOST_ASIO_COMPLETION_HANDLER_FOR, and BOOST_ASIO_COMPLETION_TOKEN_FOR
respectively. These macros expand to `typename` when concepts are unsupported.
2019-10-30 20:44:27 +11:00
Christopher Kohlhoff
77b14fff7f 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 20:39:22 +11:00
Christopher Kohlhoff
3f680fe1f7 Add automatic return type deduction to async_initiate.
Enabled for C++11 or later.
2019-10-30 20:38:31 +11:00
Christopher Kohlhoff
77d3089f2e Merge asio 1.14.1 from 'develop'. 2019-08-06 19:58:06 +10:00
Christopher Kohlhoff
5dbdd5c48c Version bump. 2019-08-06 19:46:14 +10:00
Christopher Kohlhoff
8c66b23efc Regenerate documentation. 2019-08-06 19:46:14 +10:00
Christopher Kohlhoff
7dcc939287 Revision history. 2019-08-06 19:46:14 +10:00
Christopher Kohlhoff
da41f1c35e Remove 'experimental' qualifier from contents entry for Coroutines TS support. 2019-08-06 19:46:14 +10:00
Christopher Kohlhoff
dbe6476afb Merge asio from 'develop'. 2019-07-10 22:47:35 +10:00
chris.kohlhoff
3a95f8efea Fix typo in example targets. 2019-07-09 20:10:46 +10:00
chris.kohlhoff
e8055c3208 Require C++17 or later for coroutines TS support with clang. 2019-07-09 19:54:14 +10:00
chris.kohlhoff
7f14303a80 Ensure BOOST_VERSION tests are conditional. 2019-07-09 19:51:11 +10:00
chris.kohlhoff
3db13a1576 Added wolfSSL Compatability for Asio 2019-07-09 19:50:51 +10:00
chris.kohlhoff
78f22b5a6e Move shutdown() implementation to winrt_ssocket_service to avoid name hiding. 2019-07-09 19:49:49 +10:00
chris.kohlhoff
6402f24215 Minor fix in documentation for is_dynamic_buffer 2019-07-09 19:48:34 +10:00
chris.kohlhoff
5dd7d3b0cd Preliminary Haiku support 2019-07-09 19:43:03 +10:00
chris.kohlhoff
8a8d83fb2d Serial port get_option() should be const. 2019-07-09 19:42:35 +10:00
chris.kohlhoff
539145bb74 Fix warnings about incompatible pointer cast when obtaining CancelIoEx entry point. 2019-07-09 19:41:59 +10:00
chris.kohlhoff
6f24e3d52d Fix is_*_buffer_sequence detection for user-defined sequence types. 2019-07-09 19:41:32 +10:00
chris.kohlhoff
c113adc190 Set defaults when opening a serial port on Windows. 2019-07-09 19:40:56 +10:00
chris.kohlhoff
db788cab40 Fix doxygen generation in tutorial. 2019-07-09 19:20:10 +10:00
chris.kohlhoff
1e3eea834d Annotate case fall-through in connect() implementation. 2019-07-09 19:00:05 +10:00
chris.kohlhoff
637f3404bd Eliminate a redundant move construction when completed handlers are dispatched. 2019-07-09 18:58:57 +10:00