Commit Graph

174 Commits

Author SHA1 Message Date
chris.kohlhoff
6f24e3d52d Fix is_*_buffer_sequence detection for user-defined sequence types. 2019-07-09 19:41:32 +10:00
Christopher Kohlhoff
f3a6802fdc Fix move-based async_accept between sockets with different executor types. 2019-03-31 22:49:11 +11:00
Christopher Kohlhoff
54cdc73c29 Suppress various unused variable warnings. 2019-03-07 16:18:56 +11:00
Christopher Kohlhoff
2f7af2e33c Update composed operations examples to use async_initiate and a new helper function async_compose. 2019-03-06 20:22:23 +11:00
Christopher Kohlhoff
9be88fb192 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 = boost::asio::read_until(sock, buf, '\n');
    boost::asio::write(sock, buf, boost::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 BOOST_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 BOOST_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 = boost::asio::read_until(my_socket
      boost::asio::dynamic_buffer(data, MY_MAX),
      '\n');
2019-03-03 19:53:57 +11:00
Christopher Kohlhoff
0f7e8c9915 Move rather than copy buffers when moving a composed operation implementation. 2019-03-02 16:13:50 +11:00
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
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
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
035775462e Update windows::overlapped_ptr to support custom I/O executors. 2019-02-20 18:45:53 -10:00
Christopher Kohlhoff
1c531d2618 Change archetype completion token's handler to require exact signature. 2019-02-18 23:06:57 -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
69091cc54f Fix incomplete addition of cross-compilation support. 2018-04-03 21:08:38 +10:00
Christopher Kohlhoff
d6e731e145 Add back accidentally deleted import of 'os'. 2018-04-03 19:43:07 +10:00
Christopher Kohlhoff
41fbd65fc7 Need to link boost.chrono in tests and C++03 examples. 2018-04-03 19:41:26 +10:00
Christopher Kohlhoff
d23cb643d9 Fix cross-compilation support. 2018-04-01 21:45:55 +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
b5bce45b80 Fix unit tests to compile when BOOST_ASIO_NO_DEPRECATED is defined. 2018-04-01 09:54:01 +10:00
Christopher Kohlhoff
886839cf55 Update copyright notices. 2018-03-04 21:59:30 +11:00
Christopher Kohlhoff
077ed86047 Add headers for TS compatibility. 2017-12-02 10:23:24 +11:00
Christopher Kohlhoff
094354f343 Remove old Jamfiles. 2017-12-02 09:51:28 +11:00
Christopher Kohlhoff
ce74e65aff Use asio::coroutine in latency tests. 2017-12-02 09:03:15 +11:00
Christopher Kohlhoff
2bfd4d24d0 Make sure asio/system_context.hpp is self-contained. 2017-12-02 09:03:14 +11:00
Christopher Kohlhoff
edbe617864 Restore binder support for 3, 4 and 5 arguments. 2017-12-02 09:03:14 +11:00
Christopher Kohlhoff
2e61c6f29f Add backward compatibility for the old ConnectCondition form. 2017-11-08 00:08:40 +11:00
Christopher Kohlhoff
875788fde3 Ensure make_network_vX error_code overload doesn't throw on invalid prefix length. 2017-11-08 00:08:40 +11:00
Christopher Kohlhoff
a778425068 Fix compile errors in some asio::connect overloads. 2017-11-08 00:08:40 +11:00
Christopher Kohlhoff
b60e92b13e Initial merge of Networking TS compatibility.
Merged from chriskohlhoff/asio master branch as of commit
4a4d28b0d24c53236e229bd1b5f378c9964b1ebb.
2017-10-23 21:48:43 +11:00
Christopher Kohlhoff
2b6230aef8 Make sure asio/ssl/error.hpp is self-contained. 2017-03-05 22:58:18 +11:00
Christopher Kohlhoff
f7fa336c91 Update copyright notices. 2017-03-05 22:43:47 +11:00
Christopher Kohlhoff
36eef63a9c Update copyright notices. 2016-09-11 11:35:40 +10:00
Jessica Hamilton
df50982934 Haiku: link to libnetwork 2015-12-10 22:45:24 +11:00
Christopher Kohlhoff
02ebd627d4 Fix integer conversion warnings on 64-bit Windows. 2015-03-21 22:35:32 +11:00
Christopher Kohlhoff
52841bdfbd Fix strand test. 2015-03-20 00:15:20 +11:00
Christopher Kohlhoff
41bf42b8da Update copyright notices. 2015-03-20 00:14:19 +11:00
Christopher Kohlhoff
3e2e9c8f97 Remove dependency on Boost.Test. 2015-03-20 00:04:57 +11:00
Christopher Kohlhoff
83008fc4ce Treat multicast test failures with ENODEV as non-fatal. 2015-03-19 23:55:38 +11:00
Christopher Kohlhoff
d109f120fa Explicitly mark asio::strand as deprecated.
Use asio::io_service::strand instead.
2014-10-17 22:49:14 +11:00
Christopher Kohlhoff
2ab8462f29 Unit test workaround for AIX. 2014-07-26 19:49:22 +10:00
Christopher Kohlhoff
f0e429f537 Defend against min/max macros. 2014-05-05 11:33:29 +10:00
Christopher Kohlhoff
683329556d Use link-local multicast on other BSDs too. 2014-05-04 15:17:13 +10:00
Christopher Kohlhoff
fd8471c5d6 Don't run the compile-time buffer test.
Fixes boost trac ticket #8295.
2014-05-04 10:06:45 +10:00
Christopher Kohlhoff
e81c5c42c5 Use link-local multicast on Mac OS. 2014-05-04 10:06:45 +10:00
Christopher Kohlhoff
28f690f504 Update copyright notices. 2014-05-03 09:25:39 +10:00
Christopher Kohlhoff
50fa08dbdc Change unit tests so that they don't depend on Boost.Thread.
[SVN r85800]
2013-09-20 12:04:00 +00:00
Christopher Kohlhoff
2c7c13012a Update buffered stream operations to adhere to current handler patterns.
[SVN r85798]
2013-09-20 12:00:44 +00:00