Squashed 'Sources/OpenVPNAdapter/Libraries/Vendors/asio/' changes from b3d2ab7255..90f32660cd

90f32660cd asio version 1.13.0 released
eb99518b32 Remove ASIO_ENABLE_OLD_SERVICES from documentation.
a8d0c39c92 Revision history.
efac12f649 Change default _WIN32_WINNT value to 0x0601 (Windows 7).
5bb3cf5c61 Bump minimum MSVC version for ASIO_HAS_DECLTYPE.
233254304b Add more missing entries to quick reference.
b439f14af8 Default to standalone build unless boost is explicitly specified.
0b5f03b4b7 Suppress various unused variable warnings.
ab174ab000 Don't overwrite a failure error code from the SSL engine when doing sync I/O.
45abc54125 Fix up dispatch() documentation. Clarify distinction between post() and defer().
c7d4557434 Add new cpp14 examples to doc.
b53662939f Fix template argument list bracketing.
c47c05ad31 Regenerate documentation.
265e75cdbb Define ASIO_STANDALONE automatically if C++11 or later is detected.
189a5b1453 Update composed operations examples to use async_initiate and a new helper function async_compose.
296216a122 Fix handler tracking arguments in io_context implementation.
b823ee0954 Only enable <atomic> for the most recent Xcode clang version.
54c93f73e7 Fix cross references.
32c9da2551 Fix typo in basic_stream_socket documentation.
66095aa1f2 Add new DynamicBuffer_v2 which is CopyConstructible.
d1a23c75b7 Use <atomic> when targeting apple/clang/libc++, even for C++03.
c585bdf3c9 Reduce number of copies of I/O executor.
5d9d01729d Move rather than copy buffers when moving a composed operation implementation.
2c7d26454b Completion conditions now require move rather than copy.
93337cba7b Add a fallback error code for when we get SSL_ERROR_SYSCALL without an associated error.
760e12ae22 Exclude implementation details from documentation.
0557b6ddf0 Fix parameter documentation in basic_object_handle constructor.
dc477ae51a Add ip::resolver_base to quick reference and cross reference it from ip::basic_resolver.
0a6bcd89bb Suppress eof on shutdown as it actually indicates success.
57b2ef19b0 Ensure SSL handshake errors are propagated to the peer.
93104538f6 Add noexcept to buffer_sequence_begin/end.
7c7a2555b0 Prevent implicit conversion with buffer_sequence_begin/end.
fff63d15a7 Add a make_strand function.
52eef463ef Remove experimental directory from documentation processing.
2b18f00f48 Fix long line.
536df5fd74 Deduce EndpointSequence iterator type.
bc7e0f38cf Fix calculation of absolute timeout when using pthread_cond_timedwait.
30e38527a4 Capture port by value to prevent dangling reference.
2ee7a65253 Add network_v[46].hpp headers to top-level convenience header.
1c9a4ac338 Allow visibility pragmas to be disabled by defining ASIO_DISABLE_VISIBILITY.
38d3fc09ab Add -lnetwork to LDFLAGS when building for Haiku OS.
0616f498bf Include unistd.h when targeting Haiku OS.
a10d3595eb Also set SO_REUSEPORT on QNX to correctly enable multicast.
555ed6c993 Return correct number of bytes transferred when datagram truncation occurs.
3b0daafa0b Make the executor_work_guard move constructor noexcept.
1a7b0c7220 Don't allow thread_pool locking to be set by ASIO_CONCURRENCY_HINT_ macros.
51274de46a Update list of unit tests in MSVC makefile.
4e49b8c3e5 Disambiguate enable_if and native_handle_type.
ea67e69e3a Repeat typedefs in derived class templates to fix gcc compile error on Windows.
490743a662 Promote coroutines TS support classes to asio namespace.
171a02ed0d Added constructor for local::basic_endpoint from string_view
6f40eb3155 Add noexcept qualifier to ip::basic_endpoint class.
3b4bf13bd1 Add noexcept qualifier to ip::address_v6 class.
b5b9717ed6 Add noexcept qualifier to ip::address_v4 class.
39993b3ec2 Add noexcept qualifier to ip::address class.
e7b397142a Update windows::overlapped_ptr to support custom I/O executors.
84e9a48ae6 Fix completion signatures used for ssl::stream's async_handshake and async_shutdown.
24e92ea209 Change archetype completion token's handler to require exact signature.
498dab4662 Fix compile error in serialization example.
62c4488abc New async_result form with initiate() static member function.
fc05ce407c Remove deprecated handler_type and single-argument async_result.
f9e4489b57 Update copyright notices.
cbe1c5e13d Add custom I/O executor support to I/O objects.
2c689adc90 Remove deprecated get_io_context and get_io_service functions.
9801132ea0 Remove deprecated services support.
531475f46c Use separate recycled memory slot for polymorphic executor.
22afb86087 asio version 1.12.2 released
7a566ad1e5 Ensure socks4 example header file is included in release tarball.
9d54ba058e Revision history.
b3a3961047 Fix example links.
765f197ed6 Add examples showing how to write composed operations.
11fe8b7c7e Add documentation for change in concurrency_hint type.
fd5a89b004 Regenerate documentation.
d6209b6c73 Add C++11 version of SOCKS4 example.
e7dbfcecb8 Fix long lines.
a452dfd43b Add C++11 version of SSL example.
dd006b867e Add C++11 version of timers example.
caa9450231 Add C++11 versions of timeouts examples.
019449fb0f Use new form of async_accept where socket is moved into the completion handler.
a432abc27e Execution contexts must be publicly derived from asio::execution_context.
4d7d624970 Make distinction between overloads clearer.
8c5004b100 Indicate replacements for deprecated overloads.
f03803ea8b Fix brief description of buffer() overload for non-const std::string.
eed287d46c Fix detection of std::future with libstdc++.
e0daf291bc Fix compile error in regex overload of read_until.
ff28c6f777 Clear the heap index for removed timers.
68df16d560 Fix detection of std::experimental::string_view and std::string_view with newer clang/libc++.
c7d2467be2 Add compile-time test for TLSv1 presence.
2c6b6db640 Fix macro used to test for TLS v1.2 support.
14c0108b2c Fix typo in ssl::stream::async_write_some documentation.
ed775a2ef1 Fix incorrect reference to 'io_context' in thread_pool documentation.
f5440aa76e Fix MSVC version number for availability of std::invoke_result.
b397659ded Test language version using _MSVC_LANG rather than _HAS_CXX17.
2e30e9d327 Update buffer sequence traits to test new requirements, if decltype is available.
a591f818f2 Define buffer sequence traits after buffer_sequence_begin/end has been defined.
6d2b56aafa Fix MSVC issue when building with exceptions disabled.
42a94f7cb4 Add options for TLS v1.3.
91b2dcf43d Fix typo in 'Streams, Short Reads and Short Writes' documentation section.
5cb855d024 Prevent global objects from being created once per thread on Windows.
414cdf4f83 Use heading elements to keep asynchronous requirements on one page.
a3f713e393 Fix crash when using size(), max_size() or empty() on default-constructed resolver results.
912d0d67f9 Move the return value in basic_resolver_results::begin() to avoid copying.
83e24fa04f Don't use BOOST_VERSION macro in standalone mode.
98e0bf115a ASIO_HAS_DECL_TYPE should be ASIO_HAS_DECLTYPE in is_buffer_sequence.hpp.
6554073823 Fix bug in deregister_handler in actor example.
547f06a1e4 Enable move support for the Intel Compiler.
0f9b727e9f Do not double define has_string_view with clang-cl
39a9be7786 Fix handler tracking operation name for io_context::executor_type::dispatch.
eed73f024d Fix buffer overflow when parsing an address string with a 64-bit scope id.
b73dc1d2c0 asio version 1.12.1 released
3d3bbae1b6 Add cpp17 examples to distribution.
157bdf2a87 Revision history.
5736e51cf5 Add Coroutines TS overview and examples to documentation.
b0926b61b0 Regenerate documentation.
5318eaafd6 Check for gthreads before enabling std::future with g++.
bf69d3f390 Need namespace cstd for sprintf.
a2992ace2c Remove accidentally added file.
5ddede1e25 Fix storage of decayed function and handler in spawn()-ed coroutine.
173871f855 Fixed compilation on Android NDK15+
450e65093b Fix basic_yield_context support for completion signatures with reference parameters.
bf70ad6062 Explicitly ignore result of iterator dereference.
479a0c51f4 Distinguish legacy completion handlers (which must be CopyConstructible).
d47931da7b Decay the DynamicBuffer type used in enable_if tests.
3c7bbe42ea Use std::string_view for C++17 or later, and std::experimental::string_view for C++14.
b4245aac24 Use std::invoke_result with recent MSVC.
1156fad4f0 Make add_certificate_authority process multiple certificates in a bundle
9a7ccb9bf3 Don't call SSL_COMP_free_compression_methods if SSL_OP_NO_COMPRESSION is defined.
129c654e3c Fix typo in detail::consuming_buffers specialisation.
37e32598cb Fix basic_resolver_results::value_type typedef.
5fdb48bd34 Add missing move in ssl asynchronous operation.
d31062f3fc Fix includes in some cpp11 and cpp14 examples
21e86ec26d Fix async_result when used with handler_type
68180a19ff Correct prepare_memfn_helper test
08c1955017 Detect C++11 and C++14 and automatically enable corresponding examples.
bca41a6b19 Regenerate list of installed header files.
6711b85da8 Update examples to use chrono rather than Boost.Date_Time.
d8387c93b3 Change socket iostreams to use chrono by default.
a918966260 Fix unit tests to compile when ASIO_NO_DEPRECATED is defined.
b9855c9fdb Update timeout examples to use latest features.
501dfc424a Ignore operations posted to a strand during shutdown.
7a39d8a7d9 Fix redirect_error to work with non-const error_codes.
25b8ff168a Add missing include of <sys/timerfd.h>.
2acd085dc4 Clean up some experimental::co_spawn examples.
8f39bf249f Ensure all coroutine layers are correctly attached to the 'stack'.
83c28c582f Add some more experimental::co_spawn examples.
af776b1522 Fix spurious resumption.
9a0585b63d Restrict the types that may be awaited.
daf25a7f4f Fix MSVC compile error.
5680bbb24b Fix namespace qualification issues.
d4848c3cc4 Allow the awaitable to be stored and co_await applied to it later.
4cdff8b803 Use memory recycling for awaitees.
ad1751063a Regenerate documentation.
1728c8fa42 Add experimental features to documentation.
51dcdb7d93 Fix up make_work_guard ambiguity.
80c6f596c8 Add experimental::co_spawn examples.
4e58a1b8ad Add new experimental directory to boostify script.
32cd6fdfa7 Add convenience header for experimental features.
ea40e78451 Add new experimental::co_spawn function.
be369c9789 Add new experimental::redirect_error completion token type.
15ae0bb7a6 Add new experimental::detached_t completion token type.
7b2d186ced Add missing const qualification to acceptor's get_option members.
66a1943c55 Work around a mysterious parsing error that occurs with some versions of gcc.
4ebd33ce55 Update copyright notices.

git-subtree-dir: Sources/OpenVPNAdapter/Libraries/Vendors/asio
git-subtree-split: 90f32660cd503494b3707840cfbd5434d8e9dabe
This commit is contained in:
Sergey Abramchuk
2019-06-17 09:46:13 +03:00
parent 6e5827c311
commit 9ec9e579e9
994 changed files with 49534 additions and 30303 deletions

View File

@@ -13,12 +13,14 @@ check_PROGRAMS = \
unit/associated_allocator \
unit/associated_executor \
unit/async_result \
unit/awaitable \
unit/basic_datagram_socket \
unit/basic_deadline_timer \
unit/basic_raw_socket \
unit/basic_seq_packet_socket \
unit/basic_serial_port \
unit/basic_signal_set \
unit/basic_socket \
unit/basic_socket_acceptor \
unit/basic_stream_socket \
unit/basic_streambuf \
@@ -29,13 +31,14 @@ check_PROGRAMS = \
unit/buffered_write_stream \
unit/buffer \
unit/buffers_iterator \
unit/co_spawn \
unit/completion_condition \
unit/compose \
unit/connect \
unit/coroutine \
unit/datagram_socket_service \
unit/deadline_timer_service \
unit/deadline_timer \
unit/defer \
unit/detached \
unit/dispatch \
unit/error \
unit/execution_context \
@@ -48,6 +51,7 @@ check_PROGRAMS = \
unit/generic/stream_protocol \
unit/high_resolution_timer \
unit/io_context \
unit/io_context_strand \
unit/ip/address \
unit/ip/address_v4 \
unit/ip/address_v4_iterator \
@@ -66,7 +70,6 @@ check_PROGRAMS = \
unit/ip/network_v4 \
unit/ip/network_v6 \
unit/ip/resolver_query_base \
unit/ip/resolver_service \
unit/ip/tcp \
unit/ip/udp \
unit/ip/unicast \
@@ -84,27 +87,22 @@ check_PROGRAMS = \
unit/posix/descriptor \
unit/posix/descriptor_base \
unit/posix/stream_descriptor \
unit/posix/stream_descriptor_service \
unit/post \
unit/raw_socket_service \
unit/read \
unit/read_at \
unit/read_until \
unit/seq_packet_socket_service \
unit/redirect_error \
unit/serial_port \
unit/serial_port_base \
unit/serial_port_service \
unit/signal_set \
unit/signal_set_service \
unit/socket_acceptor_service \
unit/socket_base \
unit/steady_timer \
unit/strand \
unit/stream_socket_service \
unit/streambuf \
unit/system_context \
unit/system_executor \
unit/system_timer \
unit/this_coro \
unit/thread \
unit/time_traits \
unit/ts/buffer \
@@ -115,22 +113,19 @@ check_PROGRAMS = \
unit/ts/netfwd \
unit/ts/socket \
unit/ts/timer \
unit/use_awaitable \
unit/use_future \
unit/uses_executor \
unit/wait_traits \
unit/waitable_timer_service \
unit/windows/basic_handle \
unit/windows/basic_object_handle \
unit/windows/basic_overlapped_handle \
unit/windows/basic_random_access_handle \
unit/windows/basic_stream_handle \
unit/windows/object_handle \
unit/windows/object_handle_service \
unit/windows/overlapped_handle \
unit/windows/overlapped_ptr \
unit/windows/random_access_handle \
unit/windows/random_access_handle_service \
unit/windows/stream_handle \
unit/windows/stream_handle_service \
unit/write \
unit/write_at
@@ -158,12 +153,14 @@ TESTS = \
unit/associated_allocator \
unit/associated_executor \
unit/async_result \
unit/awaitable \
unit/basic_datagram_socket \
unit/basic_deadline_timer \
unit/basic_raw_socket \
unit/basic_seq_packet_socket \
unit/basic_serial_port \
unit/basic_signal_set \
unit/basic_socket \
unit/basic_socket_acceptor \
unit/basic_stream_socket \
unit/basic_streambuf \
@@ -174,12 +171,13 @@ TESTS = \
unit/buffered_write_stream \
unit/buffer \
unit/buffers_iterator \
unit/co_spawn \
unit/completion_condition \
unit/compose \
unit/connect \
unit/datagram_socket_service \
unit/deadline_timer_service \
unit/deadline_timer \
unit/defer \
unit/detached \
unit/dispatch \
unit/error \
unit/execution_context \
@@ -187,6 +185,7 @@ TESTS = \
unit/executor_work_guard \
unit/high_resolution_timer \
unit/io_context \
unit/io_context_strand \
unit/ip/address \
unit/ip/address_v4 \
unit/ip/address_v4_iterator \
@@ -205,7 +204,6 @@ TESTS = \
unit/ip/network_v4 \
unit/ip/network_v6 \
unit/ip/resolver_query_base \
unit/ip/resolver_service \
unit/ip/tcp \
unit/ip/udp \
unit/ip/unicast \
@@ -218,32 +216,27 @@ TESTS = \
unit/local/stream_protocol \
unit/packaged_task \
unit/placeholders \
unit/posix/basic_descriptor \
unit/posix/basic_stream_descriptor \
unit/posix/basic_descriptor\
unit/posix/basic_stream_descriptor\
unit/posix/descriptor\
unit/posix/descriptor_base \
unit/posix/stream_descriptor \
unit/posix/stream_descriptor_service \
unit/post \
unit/raw_socket_service \
unit/read \
unit/read_at \
unit/read_until \
unit/seq_packet_socket_service \
unit/redirect_error \
unit/serial_port \
unit/serial_port_base \
unit/serial_port_service \
unit/signal_set \
unit/signal_set_service \
unit/socket_acceptor_service \
unit/socket_base \
unit/steady_timer \
unit/strand \
unit/stream_socket_service \
unit/streambuf \
unit/system_context \
unit/system_executor \
unit/system_timer \
unit/this_coro \
unit/thread \
unit/time_traits \
unit/ts/buffer \
@@ -254,22 +247,19 @@ TESTS = \
unit/ts/netfwd \
unit/ts/socket \
unit/ts/timer \
unit/use_awaitable \
unit/use_future \
unit/uses_executor \
unit/wait_traits \
unit/waitable_timer_service \
unit/windows/basic_handle \
unit/windows/basic_object_handle \
unit/windows/basic_overlapped_handle \
unit/windows/basic_random_access_handle \
unit/windows/basic_stream_handle \
unit/windows/object_handle \
unit/windows/object_handle_service \
unit/windows/overlapped_handle \
unit/windows/overlapped_ptr \
unit/windows/random_access_handle \
unit/windows/random_access_handle_service \
unit/windows/stream_handle \
unit/windows/stream_handle_service \
unit/write \
unit/write_at
@@ -301,12 +291,14 @@ endif
unit_associated_allocator_SOURCES = unit/associated_allocator.cpp
unit_associated_executor_SOURCES = unit/associated_executor.cpp
unit_async_result_SOURCES = unit/async_result.cpp
unit_awaitable_SOURCES = unit/awaitable.cpp
unit_basic_datagram_socket_SOURCES = unit/basic_datagram_socket.cpp
unit_basic_deadline_timer_SOURCES = unit/basic_deadline_timer.cpp
unit_basic_raw_socket_SOURCES = unit/basic_raw_socket.cpp
unit_basic_seq_packet_socket_SOURCES = unit/basic_seq_packet_socket.cpp
unit_basic_serial_port_SOURCES = unit/basic_serial_port.cpp
unit_basic_signal_set_SOURCES = unit/basic_signal_set.cpp
unit_basic_socket_SOURCES = unit/basic_socket.cpp
unit_basic_socket_acceptor_SOURCES = unit/basic_socket_acceptor.cpp
unit_basic_stream_socket_SOURCES = unit/basic_stream_socket.cpp
unit_basic_streambuf_SOURCES = unit/basic_streambuf.cpp
@@ -317,13 +309,14 @@ unit_buffers_iterator_SOURCES = unit/buffers_iterator.cpp
unit_buffered_read_stream_SOURCES = unit/buffered_read_stream.cpp
unit_buffered_stream_SOURCES = unit/buffered_stream.cpp
unit_buffered_write_stream_SOURCES = unit/buffered_write_stream.cpp
unit_co_spawn_SOURCES = unit/co_spawn.cpp
unit_completion_condition_SOURCES = unit/completion_condition.cpp
unit_compose_SOURCES = unit/compose.cpp
unit_connect_SOURCES = unit/connect.cpp
unit_coroutine_SOURCES = unit/coroutine.cpp
unit_datagram_socket_service_SOURCES = unit/datagram_socket_service.cpp
unit_deadline_timer_service_SOURCES = unit/deadline_timer_service.cpp
unit_deadline_timer_SOURCES = unit/deadline_timer.cpp
unit_defer_SOURCES = unit/defer.cpp
unit_detached_SOURCES = unit/detached.cpp
unit_dispatch_SOURCES = unit/dispatch.cpp
unit_error_SOURCES = unit/error.cpp
unit_execution_context_SOURCES = unit/execution_context.cpp
@@ -336,6 +329,7 @@ unit_generic_seq_packet_protocol_SOURCES = unit/generic/seq_packet_protocol.cpp
unit_generic_stream_protocol_SOURCES = unit/generic/stream_protocol.cpp
unit_high_resolution_timer_SOURCES = unit/high_resolution_timer.cpp
unit_io_context_SOURCES = unit/io_context.cpp
unit_io_context_strand_SOURCES = unit/io_context_strand.cpp
unit_ip_address_SOURCES = unit/ip/address.cpp
unit_ip_address_v4_SOURCES = unit/ip/address_v4.cpp
unit_ip_address_v4_iterator_SOURCES = unit/ip/address_v4_iterator.cpp
@@ -354,7 +348,6 @@ unit_ip_multicast_SOURCES = unit/ip/multicast.cpp
unit_ip_network_v4_SOURCES = unit/ip/network_v4.cpp
unit_ip_network_v6_SOURCES = unit/ip/network_v6.cpp
unit_ip_resolver_query_base_SOURCES = unit/ip/resolver_query_base.cpp
unit_ip_resolver_service_SOURCES = unit/ip/resolver_service.cpp
unit_ip_tcp_SOURCES = unit/ip/tcp.cpp
unit_ip_udp_SOURCES = unit/ip/udp.cpp
unit_ip_unicast_SOURCES = unit/ip/unicast.cpp
@@ -372,27 +365,22 @@ unit_posix_basic_stream_descriptor_SOURCES = unit/posix/basic_stream_descriptor.
unit_posix_descriptor_SOURCES = unit/posix/descriptor.cpp
unit_posix_descriptor_base_SOURCES = unit/posix/descriptor_base.cpp
unit_posix_stream_descriptor_SOURCES = unit/posix/stream_descriptor.cpp
unit_posix_stream_descriptor_service_SOURCES = unit/posix/stream_descriptor_service.cpp
unit_post_SOURCES = unit/post.cpp
unit_raw_socket_service_SOURCES = unit/raw_socket_service.cpp
unit_read_SOURCES = unit/read.cpp
unit_read_at_SOURCES = unit/read_at.cpp
unit_read_until_SOURCES = unit/read_until.cpp
unit_seq_packet_socket_service_SOURCES = unit/seq_packet_socket_service.cpp
unit_redirect_error_SOURCES = unit/redirect_error.cpp
unit_serial_port_SOURCES = unit/serial_port.cpp
unit_serial_port_base_SOURCES = unit/serial_port_base.cpp
unit_serial_port_service_SOURCES = unit/serial_port_service.cpp
unit_signal_set_SOURCES = unit/signal_set.cpp
unit_signal_set_service_SOURCES = unit/signal_set_service.cpp
unit_socket_acceptor_service_SOURCES = unit/socket_acceptor_service.cpp
unit_socket_base_SOURCES = unit/socket_base.cpp
unit_steady_timer_SOURCES = unit/steady_timer.cpp
unit_strand_SOURCES = unit/strand.cpp
unit_stream_socket_service_SOURCES = unit/stream_socket_service.cpp
unit_streambuf_SOURCES = unit/streambuf.cpp
unit_system_context_SOURCES = unit/system_context.cpp
unit_system_executor_SOURCES = unit/system_executor.cpp
unit_system_timer_SOURCES = unit/system_timer.cpp
unit_this_coro_SOURCES = unit/this_coro.cpp
unit_thread_SOURCES = unit/thread.cpp
unit_time_traits_SOURCES = unit/time_traits.cpp
unit_ts_buffer_SOURCES = unit/ts/buffer.cpp
@@ -403,22 +391,19 @@ unit_ts_net_SOURCES = unit/ts/net.cpp
unit_ts_netfwd_SOURCES = unit/ts/netfwd.cpp
unit_ts_socket_SOURCES = unit/ts/socket.cpp
unit_ts_timer_SOURCES = unit/ts/timer.cpp
unit_use_awaitable_SOURCES = unit/use_awaitable.cpp
unit_use_future_SOURCES = unit/use_future.cpp
unit_uses_executor_SOURCES = unit/uses_executor.cpp
unit_wait_traits_SOURCES = unit/wait_traits.cpp
unit_waitable_timer_service_SOURCES = unit/waitable_timer_service.cpp
unit_windows_basic_handle_SOURCES = unit/windows/basic_handle.cpp
unit_windows_basic_object_handle_SOURCES = unit/windows/basic_object_handle.cpp
unit_windows_basic_overlapped_handle_SOURCES = unit/windows/basic_overlapped_handle.cpp
unit_windows_basic_random_access_handle_SOURCES = unit/windows/basic_random_access_handle.cpp
unit_windows_basic_stream_handle_SOURCES = unit/windows/basic_stream_handle.cpp
unit_windows_object_handle_SOURCES = unit/windows/object_handle.cpp
unit_windows_object_handle_service_SOURCES = unit/windows/object_handle_service.cpp
unit_windows_overlapped_handle_SOURCES = unit/windows/overlapped_handle.cpp
unit_windows_overlapped_ptr_SOURCES = unit/windows/overlapped_ptr.cpp
unit_windows_random_access_handle_SOURCES = unit/windows/random_access_handle.cpp
unit_windows_random_access_handle_service_SOURCES = unit/windows/random_access_handle_service.cpp
unit_windows_stream_handle_SOURCES = unit/windows/stream_handle.cpp
unit_windows_stream_handle_service_SOURCES = unit/windows/stream_handle_service.cpp
unit_write_SOURCES = unit/write.cpp
unit_write_at_SOURCES = unit/write_at.cpp
@@ -436,8 +421,6 @@ EXTRA_DIST = \
performance/handler_allocator.hpp \
unit/archetypes/async_ops.hpp \
unit/archetypes/async_result.hpp \
unit/archetypes/deprecated_async_result.hpp \
unit/archetypes/deprecated_async_ops.hpp \
unit/archetypes/gettable_socket_option.hpp \
unit/archetypes/io_control_command.hpp \
unit/archetypes/settable_socket_option.hpp

View File

@@ -2,7 +2,7 @@
// allocator.hpp
// ~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// high_res_clock.hpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// tcp_client.cpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// tcp_server.cpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -27,7 +27,7 @@ class tcp_server : asio::coroutine
public:
tcp_server(tcp::acceptor& acceptor, std::size_t buf_size) :
acceptor_(acceptor),
socket_(acceptor_.get_executor().context()),
socket_(acceptor_.get_executor()),
buffer_(buf_size)
{
}

View File

@@ -2,7 +2,7 @@
// udp_client.cpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// udp_server.cpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// client.cpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -198,7 +198,7 @@ public:
sessions_(),
stats_()
{
stop_timer_.expires_from_now(boost::posix_time::seconds(timeout));
stop_timer_.expires_after(asio::chrono::seconds(timeout));
stop_timer_.async_wait(boost::bind(&client::handle_timeout, this));
for (size_t i = 0; i < session_count; ++i)
@@ -228,7 +228,7 @@ public:
private:
asio::io_context& io_context_;
asio::deadline_timer stop_timer_;
asio::steady_timer stop_timer_;
std::list<session*> sessions_;
stats stats_;
};

View File

@@ -2,7 +2,7 @@
// handler_allocator.cpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// server.cpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -10,12 +10,14 @@
associated_allocator
associated_executor
async_result
awaitable
basic_datagram_socket
basic_deadline_timer
basic_raw_socket
basic_seq_packet_socket
basic_serial_port
basic_signal_set
basic_socket
basic_socket_acceptor
basic_stream_socket
basic_streambuf
@@ -26,13 +28,14 @@ buffered_read_stream
buffered_stream
buffered_write_stream
buffers_iterator
co_spawn
completion_condition
compose
connect
coroutine
datagram_socket_service
deadline_timer
deadline_timer_service
defer
detached
dispatch
error
error_handler
@@ -47,30 +50,26 @@ is_write_buffered
packaged_task
placeholders
post
raw_socket_service
read
read_at
read_until
seq_packet_socket_service
redirect_error
serial_port
serial_port_base
serial_port_service
signal_set
signal_set_service
socket_acceptor_service
socket_base
steady_timer
strand
stream_socket_service
streambuf
system_context
system_executor
system_timer
this_coro
thread
time_traits
use_awaitable
use_future
uses_executor
wait_traits
waitable_timer_service
write
write_at

View File

@@ -2,7 +2,7 @@
// async_ops.hpp
// ~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// async_result.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -19,19 +19,35 @@ struct lazy_handler
{
};
struct concrete_handler
template <typename Signature>
struct concrete_handler;
template <typename R, typename Arg1>
struct concrete_handler<R(Arg1)>
{
concrete_handler(lazy_handler)
{
}
template <typename Arg1>
void operator()(Arg1)
void operator()(typename asio::decay<Arg1>::type)
{
}
template <typename Arg1, typename Arg2>
void operator()(Arg1, Arg2)
#if defined(ASIO_HAS_MOVE)
concrete_handler(concrete_handler&&) {}
private:
concrete_handler(const concrete_handler&);
#endif // defined(ASIO_HAS_MOVE)
};
template <typename R, typename Arg1, typename Arg2>
struct concrete_handler<R(Arg1, Arg2)>
{
concrete_handler(lazy_handler)
{
}
void operator()(typename asio::decay<Arg1>::type, typename asio::decay<Arg2>::type)
{
}
@@ -51,7 +67,7 @@ class async_result<archetypes::lazy_handler, Signature>
{
public:
// The concrete completion handler type.
typedef archetypes::concrete_handler completion_handler_type;
typedef archetypes::concrete_handler<Signature> completion_handler_type;
// The return type of the initiating function.
typedef int return_type;

View File

@@ -1,345 +0,0 @@
//
// deprecated_async_ops.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ARCHETYPES_DEPRECATED_ASYNC_OPS_HPP
#define ARCHETYPES_DEPRECATED_ASYNC_OPS_HPP
#include <asio/async_result.hpp>
#if !defined(ASIO_NO_DEPRECATED)
#include <asio/handler_type.hpp>
#include <asio/error.hpp>
#include <asio/io_context.hpp>
#if defined(ASIO_HAS_BOOST_BIND)
# include <boost/bind.hpp>
#else // defined(ASIO_HAS_BOOST_BIND)
# include <functional>
#endif // defined(ASIO_HAS_BOOST_BIND)
namespace archetypes {
#if defined(ASIO_HAS_BOOST_BIND)
namespace bindns = boost;
#else // defined(ASIO_HAS_BOOST_BIND)
namespace bindns = std;
#endif // defined(ASIO_HAS_BOOST_BIND)
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void()>::type>::type
deprecated_async_op_0(asio::io_context& ctx,
ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void()>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler)));
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(asio::error_code)>::type>::type
deprecated_async_op_ec_0(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(asio::error_code)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code()));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(asio::error::operation_aborted)));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(std::exception_ptr)>::type>::type
deprecated_async_op_ex_0(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(std::exception_ptr)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::exception_ptr()));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::make_exception_ptr(std::runtime_error("blah"))));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(int)>::type>::type
deprecated_async_op_1(asio::io_context& ctx,
ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(int)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler), 42));
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(asio::error_code, int)>::type>::type
deprecated_async_op_ec_1(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(asio::error_code, int)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(), 42));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(asio::error::operation_aborted), 0));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int)>::type>::type
deprecated_async_op_ex_1(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::exception_ptr(), 42));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::make_exception_ptr(std::runtime_error("blah")), 0));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(int, double)>::type>::type
deprecated_async_op_2(asio::io_context& ctx,
ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(int, double)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
42, 2.0));
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(asio::error_code, int, double)>::type>::type
deprecated_async_op_ec_2(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(asio::error_code, int, double)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(), 42, 2.0));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(asio::error::operation_aborted),
0, 0.0));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int, double)>::type>::type
deprecated_async_op_ex_2(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int, double)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::exception_ptr(), 42, 2.0));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::make_exception_ptr(std::runtime_error("blah")), 0, 0.0));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(int, double, char)>::type>::type
deprecated_async_op_3(asio::io_context& ctx,
ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(int, double, char)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
42, 2.0, 'a'));
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(asio::error_code, int, double, char)>::type>::type
deprecated_async_op_ec_3(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(asio::error_code, int, double, char)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(), 42, 2.0, 'a'));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(asio::error::operation_aborted),
0, 0.0, 'z'));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int, double, char)>::type>::type
deprecated_async_op_ex_3(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int, double, char)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::exception_ptr(), 42, 2.0, 'a'));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::make_exception_ptr(std::runtime_error("blah")),
0, 0.0, 'z'));
}
return result.get();
}
} // namespace archetypes
#endif // !defined(ASIO_NO_DEPRECATED)
#endif // ARCHETYPES_DEPRECATED_ASYNC_OPS_HPP

View File

@@ -1,82 +0,0 @@
//
// async_result.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP
#define ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP
#include <asio/async_result.hpp>
#if !defined(ASIO_NO_DEPRECATED)
#include <asio/handler_type.hpp>
namespace archetypes {
struct deprecated_lazy_handler
{
};
struct deprecated_concrete_handler
{
deprecated_concrete_handler(deprecated_lazy_handler)
{
}
template <typename Arg1>
void operator()(Arg1)
{
}
template <typename Arg1, typename Arg2>
void operator()(Arg1, Arg2)
{
}
#if defined(ASIO_HAS_MOVE)
deprecated_concrete_handler(deprecated_concrete_handler&&) {}
private:
deprecated_concrete_handler(const deprecated_concrete_handler&);
#endif // defined(ASIO_HAS_MOVE)
};
} // namespace archetypes
namespace asio {
template <typename Signature>
struct handler_type<archetypes::deprecated_lazy_handler, Signature>
{
typedef archetypes::deprecated_concrete_handler type;
};
template <>
class async_result<archetypes::deprecated_concrete_handler>
{
public:
// The return type of the initiating function.
typedef double type;
// Construct an async_result from a given handler.
explicit async_result(archetypes::deprecated_concrete_handler&)
{
}
// Obtain the value to be returned from the initiating function.
type get()
{
return 42;
}
};
} // namespace asio
#endif // !defined(ASIO_NO_DEPRECATED)
#endif // ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP

View File

@@ -2,7 +2,7 @@
// gettable_socket_option.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// io_control_command.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// settable_socket_option.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// associated_allocator.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// associated_executor.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// async_result.cpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -1,8 +1,8 @@
//
// signal_set_service.cpp
// ~~~~~~~~~~~~~~~~~~~~~~
// awaitable.cpp
// ~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -14,12 +14,12 @@
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/signal_set_service.hpp"
#include "asio/awaitable.hpp"
#include "unit_test.hpp"
ASIO_TEST_SUITE
(
"signal_set_service",
"awaitable",
ASIO_TEST_CASE(null_test)
)

View File

@@ -2,7 +2,7 @@
// basic_datagram_socket.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_deadline_timer.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_raw_socket.cpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_seq_packet_socket.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_serial_port.cpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying

View File

@@ -2,7 +2,7 @@
// basic_signal_set.cpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -1,8 +1,8 @@
//
// raw_socket_service.cpp
// ~~~~~~~~~~~~~~~~~~~~~~
// basic_socket.cpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -14,12 +14,12 @@
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/raw_socket_service.hpp"
#include "asio/basic_socket.hpp"
#include "unit_test.hpp"
ASIO_TEST_SUITE
(
"raw_socket_service",
"basic_socket",
ASIO_TEST_CASE(null_test)
)

View File

@@ -2,7 +2,7 @@
// basic_socket_acceptor.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_stream_socket.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_streambuf.cpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_waitable_timer.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// bind_executor.cpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// buffer.cpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -62,18 +62,17 @@ void test()
std::vector<mutable_buffer> mutable_buffer_sequence;
std::vector<const_buffer> const_buffer_sequence;
#if defined(ASIO_HAS_STD_STRING_VIEW)
# if defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_data(string_data);
# else // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::string_view string_view_data(string_data);
# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
#endif // defined(ASIO_HAS_STD_STRING_VIEW)
#elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_data(string_data);
#endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
// mutable_buffer constructors.
mutable_buffer mb1;
mutable_buffer mb2(void_ptr_data, 1024);
mutable_buffer mb3(mb1);
(void)mb3;
// mutable_buffer functions.
@@ -110,7 +109,9 @@ void test()
const_buffer cb1;
const_buffer cb2(const_void_ptr_data, 1024);
const_buffer cb3(cb1);
(void)cb3;
const_buffer cb4(mb1);
(void)cb4;
// const_buffer functions.
@@ -204,10 +205,10 @@ void test()
mb1 = buffer(string_data, 1024);
cb1 = buffer(const_string_data);
cb1 = buffer(const_string_data, 1024);
#if defined(ASIO_HAS_STD_STRING_VIEW)
#if defined(ASIO_HAS_STRING_VIEW)
cb1 = buffer(string_view_data);
cb1 = buffer(string_view_data, 1024);
#endif // defined(ASIO_HAS_STD_STRING_VIEW)
#endif // defined(ASIO_HAS_STRING_VIEW)
// buffer_copy function overloads.
@@ -321,6 +322,7 @@ void test()
std::size_t size40 = db3.max_size();
(void)size40;
#if !defined(ASIO_NO_DYNAMIC_BUFFER_V1)
dynamic_string_buffer<char, std::string::traits_type,
std::string::allocator_type>::const_buffers_type
cb5 = db1.data();
@@ -339,9 +341,35 @@ void test()
db1.commit(1024);
db3.commit(1024);
#endif // !defined(ASIO_NO_DYNAMIC_BUFFER_V1)
db1.consume(1024);
db3.consume(1024);
dynamic_string_buffer<char, std::string::traits_type,
std::string::allocator_type>::mutable_buffers_type
mb7 = db1.data(0, 1);
(void)mb7;
dynamic_vector_buffer<char, std::allocator<char> >::mutable_buffers_type
mb8 = db3.data(0, 1);
(void)mb8;
dynamic_string_buffer<char, std::string::traits_type,
std::string::allocator_type>::const_buffers_type
cb7 = static_cast<const dynamic_string_buffer<char,
std::string::traits_type,
std::string::allocator_type>&>(db1).data(0, 1);
(void)cb7;
dynamic_vector_buffer<char, std::allocator<char> >::const_buffers_type
cb8 = static_cast<const dynamic_vector_buffer<char,
std::allocator<char> >&>(db3).data(0, 1);
(void)cb8;
db1.grow(1024);
db3.grow(1024);
db1.shrink(1024);
db3.shrink(1024);
db1.consume(0);
db3.consume(0);
}
catch (std::exception&)
{

View File

@@ -2,7 +2,7 @@
// buffered_read_stream.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -81,14 +81,6 @@ void test_compile()
stream_type::executor_type ex = stream1.get_executor();
(void)ex;
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = stream1.get_io_context();
(void)ioc_ref;
io_context& ioc_ref2 = stream1.get_io_service();
(void)ioc_ref2;
#endif // !defined(ASIO_NO_DEPRECATED)
stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer();
(void)lowest_layer;

View File

@@ -2,7 +2,7 @@
// buffered_stream.cpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -85,14 +85,6 @@ void test_compile()
stream_type::executor_type ex = stream1.get_executor();
(void)ex;
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = stream1.get_io_context();
(void)ioc_ref;
io_context& ioc_ref2 = stream1.get_io_service();
(void)ioc_ref2;
#endif // !defined(ASIO_NO_DEPRECATED)
stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer();
(void)lowest_layer;

View File

@@ -2,7 +2,7 @@
// buffered_write_stream.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -81,14 +81,6 @@ void test_compile()
stream_type::executor_type ex = stream1.get_executor();
(void)ex;
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = stream1.get_io_context();
(void)ioc_ref;
io_context& ioc_ref2 = stream1.get_io_service();
(void)ioc_ref2;
#endif // !defined(ASIO_NO_DEPRECATED)
stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer();
(void)lowest_layer;

View File

@@ -2,7 +2,7 @@
// buffers_iterator.cpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -1,8 +1,8 @@
//
// stream_socket_service.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
// co_spawn.cpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -14,12 +14,12 @@
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/stream_socket_service.hpp"
#include "asio/co_spawn.hpp"
#include "unit_test.hpp"
ASIO_TEST_SUITE
(
"stream_socket_service",
"co_spawn",
ASIO_TEST_CASE(null_test)
)

View File

@@ -2,7 +2,7 @@
// completion_condition.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -0,0 +1,185 @@
//
// compose.cpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Disable autolinking for unit tests.
#if !defined(BOOST_ALL_NO_LIB)
#define BOOST_ALL_NO_LIB 1
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/compose.hpp"
#include "unit_test.hpp"
#include "asio/io_context.hpp"
#include "asio/post.hpp"
#if defined(ASIO_HAS_BOOST_BIND)
# include <boost/bind.hpp>
#else // defined(ASIO_HAS_BOOST_BIND)
# include <functional>
#endif // defined(ASIO_HAS_BOOST_BIND)
//------------------------------------------------------------------------------
class impl_0_completion_args
{
public:
explicit impl_0_completion_args(asio::io_context& ioc)
: ioc_(ioc),
state_(starting)
{
}
template <typename Self>
void operator()(Self& self)
{
switch (state_)
{
case starting:
state_ = posting;
asio::post(ioc_, ASIO_MOVE_CAST(Self)(self));
break;
case posting:
self.complete();
break;
default:
break;
}
}
private:
asio::io_context& ioc_;
enum { starting, posting } state_;
};
template <typename CompletionToken>
ASIO_INITFN_RESULT_TYPE(CompletionToken, void())
async_0_completion_args(asio::io_context& ioc,
ASIO_MOVE_ARG(CompletionToken) token)
{
return asio::async_compose<CompletionToken, void()>(
impl_0_completion_args(ioc), token);
}
void compose_0_args_handler(int* count)
{
++(*count);
}
void compose_0_completion_args_test()
{
#if defined(ASIO_HAS_BOOST_BIND)
namespace bindns = boost;
#else // defined(ASIO_HAS_BOOST_BIND)
namespace bindns = std;
#endif // defined(ASIO_HAS_BOOST_BIND)
asio::io_context ioc;
int count = 0;
async_0_completion_args(ioc, bindns::bind(&compose_0_args_handler, &count));
// No handlers can be called until run() is called.
ASIO_CHECK(!ioc.stopped());
ASIO_CHECK(count == 0);
ioc.run();
// The run() call will not return until all work has finished.
ASIO_CHECK(ioc.stopped());
ASIO_CHECK(count == 1);
}
//------------------------------------------------------------------------------
class impl_1_completion_arg
{
public:
explicit impl_1_completion_arg(asio::io_context& ioc)
: ioc_(ioc),
state_(starting)
{
}
template <typename Self>
void operator()(Self& self)
{
switch (state_)
{
case starting:
state_ = posting;
asio::post(ioc_, ASIO_MOVE_CAST(Self)(self));
break;
case posting:
self.complete(42);
break;
default:
break;
}
}
private:
asio::io_context& ioc_;
enum { starting, posting } state_;
};
template <typename CompletionToken>
ASIO_INITFN_RESULT_TYPE(CompletionToken, void(int))
async_1_completion_arg(asio::io_context& ioc,
ASIO_MOVE_ARG(CompletionToken) token)
{
return asio::async_compose<CompletionToken, void(int)>(
impl_1_completion_arg(ioc), token);
}
void compose_1_args_handler(int* count, int* result_out, int result)
{
++(*count);
*result_out = result;
}
void compose_1_completion_arg_test()
{
#if defined(ASIO_HAS_BOOST_BIND)
namespace bindns = boost;
#else // defined(ASIO_HAS_BOOST_BIND)
namespace bindns = std;
using std::placeholders::_1;
#endif // defined(ASIO_HAS_BOOST_BIND)
asio::io_context ioc;
int count = 0;
int result = 0;
async_1_completion_arg(ioc,
bindns::bind(&compose_1_args_handler, &count, &result, _1));
// No handlers can be called until run() is called.
ASIO_CHECK(!ioc.stopped());
ASIO_CHECK(count == 0);
ASIO_CHECK(result == 0);
ioc.run();
// The run() call will not return until all work has finished.
ASIO_CHECK(ioc.stopped());
ASIO_CHECK(count == 1);
ASIO_CHECK(result == 42);
}
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"compose",
ASIO_TEST_CASE(compose_0_completion_args_test)
ASIO_TEST_CASE(compose_1_completion_arg_test)
)

View File

@@ -2,7 +2,7 @@
// connect.cpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// coroutine.cpp
// ~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// deadline_timer.cpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// defer.cpp
// ~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -1,8 +1,8 @@
//
// deadline_timer_service.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
// detached.cpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -14,12 +14,12 @@
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/deadline_timer_service.hpp"
#include "asio/detached.hpp"
#include "unit_test.hpp"
ASIO_TEST_SUITE
(
"deadline_timer_service",
"detached",
ASIO_TEST_CASE(null_test)
)

View File

@@ -2,7 +2,7 @@
// dispatch.cpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// error.cpp
// ~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// execution_context.cpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// executor.cpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// executor_work_guard.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// generic/basic_endpoint.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// generic/datagram_protocol.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -97,14 +97,6 @@ void test()
dp::socket::executor_type ex = socket1.get_executor();
(void)ex;
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
io_context& ioc_ref2 = socket1.get_io_service();
(void)ioc_ref2;
#endif // !defined(ASIO_NO_DEPRECATED)
// basic_socket functions.
dp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
@@ -162,10 +154,14 @@ void test()
socket1.io_control(io_control_command, ec);
dp::endpoint endpoint1 = socket1.local_endpoint();
(void)endpoint1;
dp::endpoint endpoint2 = socket1.local_endpoint(ec);
(void)endpoint2;
dp::endpoint endpoint3 = socket1.remote_endpoint();
(void)endpoint3;
dp::endpoint endpoint4 = socket1.remote_endpoint(ec);
(void)endpoint4;
socket1.shutdown(socket_base::shutdown_both);
socket1.shutdown(socket_base::shutdown_both, ec);

View File

@@ -2,7 +2,7 @@
// generic/raw_protocol.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -97,14 +97,6 @@ void test()
rp::socket::executor_type ex = socket1.get_executor();
(void)ex;
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
io_context& ioc_ref2 = socket1.get_io_service();
(void)ioc_ref2;
#endif // !defined(ASIO_NO_DEPRECATED)
// basic_socket functions.
rp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
@@ -162,10 +154,14 @@ void test()
socket1.io_control(io_control_command, ec);
rp::endpoint endpoint1 = socket1.local_endpoint();
(void)endpoint1;
rp::endpoint endpoint2 = socket1.local_endpoint(ec);
(void)endpoint2;
rp::endpoint endpoint3 = socket1.remote_endpoint();
(void)endpoint3;
rp::endpoint endpoint4 = socket1.remote_endpoint(ec);
(void)endpoint4;
socket1.shutdown(socket_base::shutdown_both);
socket1.shutdown(socket_base::shutdown_both, ec);

View File

@@ -2,7 +2,7 @@
// generic/seq_packet_protocol.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -93,14 +93,6 @@ void test()
spp::socket::executor_type ex = socket1.get_executor();
(void)ex;
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
io_context& ioc_ref2 = socket1.get_io_service();
(void)ioc_ref2;
#endif // !defined(ASIO_NO_DEPRECATED)
// basic_socket functions.
spp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
@@ -158,10 +150,14 @@ void test()
socket1.io_control(io_control_command, ec);
spp::endpoint endpoint1 = socket1.local_endpoint();
(void)endpoint1;
spp::endpoint endpoint2 = socket1.local_endpoint(ec);
(void)endpoint2;
spp::endpoint endpoint3 = socket1.remote_endpoint();
(void)endpoint3;
spp::endpoint endpoint4 = socket1.remote_endpoint(ec);
(void)endpoint4;
socket1.shutdown(socket_base::shutdown_both);
socket1.shutdown(socket_base::shutdown_both, ec);

View File

@@ -2,7 +2,7 @@
// generic/stream_protocol.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -107,14 +107,6 @@ void test()
sp::socket::executor_type ex = socket1.get_executor();
(void)ex;
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
io_context& ioc_ref2 = socket1.get_io_service();
(void)ioc_ref2;
#endif // !defined(ASIO_NO_DEPRECATED)
// basic_socket functions.
sp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
@@ -178,10 +170,14 @@ void test()
socket1.io_control(io_control_command, ec);
sp::endpoint endpoint1 = socket1.local_endpoint();
(void)endpoint1;
sp::endpoint endpoint2 = socket1.local_endpoint(ec);
(void)endpoint2;
sp::endpoint endpoint3 = socket1.remote_endpoint();
(void)endpoint3;
sp::endpoint endpoint4 = socket1.remote_endpoint(ec);
(void)endpoint4;
socket1.shutdown(socket_base::shutdown_both);
socket1.shutdown(socket_base::shutdown_both, ec);

View File

@@ -2,7 +2,7 @@
// high_resolution_timer.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// io_context.cpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -0,0 +1,325 @@
//
// io_context_strand.cpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Disable autolinking for unit tests.
#if !defined(BOOST_ALL_NO_LIB)
#define BOOST_ALL_NO_LIB 1
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/io_context_strand.hpp"
#include <sstream>
#include "asio/io_context.hpp"
#include "asio/dispatch.hpp"
#include "asio/post.hpp"
#include "asio/thread.hpp"
#include "unit_test.hpp"
#if defined(ASIO_HAS_BOOST_DATE_TIME)
# include "asio/deadline_timer.hpp"
#else // defined(ASIO_HAS_BOOST_DATE_TIME)
# include "asio/steady_timer.hpp"
#endif // defined(ASIO_HAS_BOOST_DATE_TIME)
#if defined(ASIO_HAS_BOOST_BIND)
# include <boost/bind.hpp>
#else // defined(ASIO_HAS_BOOST_BIND)
# include <functional>
#endif // defined(ASIO_HAS_BOOST_BIND)
using namespace asio;
#if defined(ASIO_HAS_BOOST_BIND)
namespace bindns = boost;
#else // defined(ASIO_HAS_BOOST_BIND)
namespace bindns = std;
#endif
#if defined(ASIO_HAS_BOOST_DATE_TIME)
typedef deadline_timer timer;
namespace chronons = boost::posix_time;
#elif defined(ASIO_HAS_CHRONO)
typedef steady_timer timer;
namespace chronons = asio::chrono;
#endif // defined(ASIO_HAS_BOOST_DATE_TIME)
void increment(int* count)
{
++(*count);
}
void increment_without_lock(io_context::strand* s, int* count)
{
ASIO_CHECK(!s->running_in_this_thread());
int original_count = *count;
dispatch(*s, bindns::bind(increment, count));
// No other functions are currently executing through the locking dispatcher,
// so the previous call to dispatch should have successfully nested.
ASIO_CHECK(*count == original_count + 1);
}
void increment_with_lock(io_context::strand* s, int* count)
{
ASIO_CHECK(s->running_in_this_thread());
int original_count = *count;
dispatch(*s, bindns::bind(increment, count));
// The current function already holds the strand's lock, so the
// previous call to dispatch should have successfully nested.
ASIO_CHECK(*count == original_count + 1);
}
void sleep_increment(io_context* ioc, int* count)
{
timer t(*ioc, chronons::seconds(2));
t.wait();
++(*count);
}
void increment_by_a(int* count, int a)
{
(*count) += a;
}
void increment_by_a_b(int* count, int a, int b)
{
(*count) += a + b;
}
void increment_by_a_b_c(int* count, int a, int b, int c)
{
(*count) += a + b + c;
}
void increment_by_a_b_c_d(int* count, int a, int b, int c, int d)
{
(*count) += a + b + c + d;
}
void start_sleep_increments(io_context* ioc, io_context::strand* s, int* count)
{
// Give all threads a chance to start.
timer t(*ioc, chronons::seconds(2));
t.wait();
// Start three increments.
post(*s, bindns::bind(sleep_increment, ioc, count));
post(*s, bindns::bind(sleep_increment, ioc, count));
post(*s, bindns::bind(sleep_increment, ioc, count));
}
void throw_exception()
{
throw 1;
}
void io_context_run(io_context* ioc)
{
ioc->run();
}
void strand_test()
{
io_context ioc;
io_context::strand s(ioc);
int count = 0;
post(ioc, bindns::bind(increment_without_lock, &s, &count));
// No handlers can be called until run() is called.
ASIO_CHECK(count == 0);
ioc.run();
// The run() call will not return until all work has finished.
ASIO_CHECK(count == 1);
count = 0;
ioc.restart();
post(s, bindns::bind(increment_with_lock, &s, &count));
// No handlers can be called until run() is called.
ASIO_CHECK(count == 0);
ioc.run();
// The run() call will not return until all work has finished.
ASIO_CHECK(count == 1);
count = 0;
ioc.restart();
post(ioc, bindns::bind(start_sleep_increments, &ioc, &s, &count));
thread thread1(bindns::bind(io_context_run, &ioc));
thread thread2(bindns::bind(io_context_run, &ioc));
// Check all events run one after another even though there are two threads.
timer timer1(ioc, chronons::seconds(3));
timer1.wait();
ASIO_CHECK(count == 0);
#if defined(ASIO_HAS_BOOST_DATE_TIME)
timer1.expires_at(timer1.expires_at() + chronons::seconds(2));
#else // defined(ASIO_HAS_BOOST_DATE_TIME)
timer1.expires_at(timer1.expiry() + chronons::seconds(2));
#endif // defined(ASIO_HAS_BOOST_DATE_TIME)
timer1.wait();
ASIO_CHECK(count == 1);
#if defined(ASIO_HAS_BOOST_DATE_TIME)
timer1.expires_at(timer1.expires_at() + chronons::seconds(2));
#else // defined(ASIO_HAS_BOOST_DATE_TIME)
timer1.expires_at(timer1.expiry() + chronons::seconds(2));
#endif // defined(ASIO_HAS_BOOST_DATE_TIME)
timer1.wait();
ASIO_CHECK(count == 2);
thread1.join();
thread2.join();
// The run() calls will not return until all work has finished.
ASIO_CHECK(count == 3);
count = 0;
int exception_count = 0;
ioc.restart();
post(s, throw_exception);
post(s, bindns::bind(increment, &count));
post(s, bindns::bind(increment, &count));
post(s, throw_exception);
post(s, bindns::bind(increment, &count));
// No handlers can be called until run() is called.
ASIO_CHECK(count == 0);
ASIO_CHECK(exception_count == 0);
for (;;)
{
try
{
ioc.run();
break;
}
catch (int)
{
++exception_count;
}
}
// The run() calls will not return until all work has finished.
ASIO_CHECK(count == 3);
ASIO_CHECK(exception_count == 2);
count = 0;
ioc.restart();
// Check for clean shutdown when handlers posted through an orphaned strand
// are abandoned.
{
io_context::strand s2(ioc);
post(s2, bindns::bind(increment, &count));
post(s2, bindns::bind(increment, &count));
post(s2, bindns::bind(increment, &count));
}
// No handlers can be called until run() is called.
ASIO_CHECK(count == 0);
}
void strand_wrap_test()
{
#if !defined(ASIO_NO_DEPRECATED)
io_context ioc;
io_context::strand s(ioc);
int count = 0;
s.wrap(bindns::bind(increment, &count))();
// No handlers can be called until run() is called.
ASIO_CHECK(count == 0);
ioc.restart();
ioc.run();
// The run() calls will not return until all work has finished.
ASIO_CHECK(count == 1);
count = 0;
s.wrap(increment)(&count);
// No handlers can be called until run() is called.
ASIO_CHECK(count == 0);
ioc.restart();
ioc.run();
// The run() calls will not return until all work has finished.
ASIO_CHECK(count == 1);
count = 0;
s.wrap(increment_by_a)(&count, 1);
// No handlers can be called until run() is called.
ASIO_CHECK(count == 0);
ioc.restart();
ioc.run();
// The run() calls will not return until all work has finished.
ASIO_CHECK(count == 1);
count = 0;
s.wrap(increment_by_a_b)(&count, 1, 2);
// No handlers can be called until run() is called.
ASIO_CHECK(count == 0);
ioc.restart();
ioc.run();
// The run() calls will not return until all work has finished.
ASIO_CHECK(count == 3);
count = 0;
s.wrap(increment_by_a_b_c)(&count, 1, 2, 3);
// No handlers can be called until run() is called.
ASIO_CHECK(count == 0);
ioc.restart();
ioc.run();
// The run() calls will not return until all work has finished.
ASIO_CHECK(count == 6);
count = 0;
s.wrap(increment_by_a_b_c_d)(&count, 1, 2, 3, 4);
// No handlers can be called until run() is called.
ASIO_CHECK(count == 0);
ioc.restart();
ioc.run();
// The run() calls will not return until all work has finished.
ASIO_CHECK(count == 10);
#endif // !defined(ASIO_NO_DEPRECATED)
}
ASIO_TEST_SUITE
(
"strand",
ASIO_TEST_CASE(strand_test)
ASIO_TEST_CASE(strand_wrap_test)
)

View File

@@ -21,7 +21,6 @@ multicast
network_v4
network_v6
resolver_query_base
resolver_service
tcp
udp
unicast

View File

@@ -2,7 +2,7 @@
// address.cpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -108,15 +108,15 @@ void test()
addr1 = ip::make_address("127.0.0.1", ec);
addr1 = ip::make_address(string_value);
addr1 = ip::make_address(string_value, ec);
#if defined(ASIO_HAS_STD_STRING_VIEW)
# if defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_value("127.0.0.1");
# else // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
#if defined(ASIO_HAS_STRING_VIEW)
# if defined(ASIO_HAS_STD_STRING_VIEW)
std::string_view string_view_value("127.0.0.1");
# elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_value("127.0.0.1");
# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
addr1 = ip::make_address(string_view_value);
addr1 = ip::make_address(string_view_value, ec);
#endif // defined(ASIO_HAS_STD_STRING_VIEW)
#endif // defined(ASIO_HAS_STRING_VIEW)
// address I/O.

View File

@@ -2,7 +2,7 @@
// address_v4.cpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -132,15 +132,15 @@ void test()
addr1 = ip::make_address_v4("127.0.0.1", ec);
addr1 = ip::make_address_v4(string_value);
addr1 = ip::make_address_v4(string_value, ec);
#if defined(ASIO_HAS_STD_STRING_VIEW)
# if defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_value("127.0.0.1");
# else // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
#if defined(ASIO_HAS_STRING_VIEW)
# if defined(ASIO_HAS_STD_STRING_VIEW)
std::string_view string_view_value("127.0.0.1");
# elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_value("127.0.0.1");
# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
addr1 = ip::make_address_v4(string_view_value);
addr1 = ip::make_address_v4(string_view_value, ec);
#endif // defined(ASIO_HAS_STD_STRING_VIEW)
#endif // defined(ASIO_HAS_STRING_VIEW)
// address_v4 I/O.

View File

@@ -2,7 +2,7 @@
// address_v4_iterator.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// address_v4_range.cpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// address_v6.cpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -144,15 +144,15 @@ void test()
addr1 = ip::make_address_v6("0::0", ec);
addr1 = ip::make_address_v6(string_value);
addr1 = ip::make_address_v6(string_value, ec);
#if defined(ASIO_HAS_STD_STRING_VIEW)
# if defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_value("0::0");
# else // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
#if defined(ASIO_HAS_STRING_VIEW)
# if defined(ASIO_HAS_STD_STRING_VIEW)
std::string_view string_view_value("0::0");
# else // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_value("0::0");
# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
addr1 = ip::make_address_v6(string_view_value);
addr1 = ip::make_address_v6(string_view_value, ec);
#endif // defined(ASIO_HAS_STD_STRING_VIEW)
#endif // defined(ASIO_HAS_STRING_VIEW)
// address_v6 IPv4-mapped conversion.
#if defined(ASIO_NO_DEPRECATED)

View File

@@ -2,7 +2,7 @@
// address_v6_iterator.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// address_v6_range.cpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_endpoint.cpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_resolver.cpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_resolver_entry.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_resolver_iterator.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_resolver_query.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// host_name.cpp
// ~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// icmp.cpp
// ~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -21,7 +21,6 @@
#include "asio/placeholders.hpp"
#include "../unit_test.hpp"
#include "../archetypes/async_result.hpp"
#include "../archetypes/deprecated_async_result.hpp"
#include "../archetypes/gettable_socket_option.hpp"
#include "../archetypes/io_control_command.hpp"
#include "../archetypes/settable_socket_option.hpp"
@@ -76,6 +75,7 @@ void test()
try
{
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
char mutable_char_buffer[128] = "";
const char const_char_buffer[128] = "";
socket_base::message_flags in_flags = 0;
@@ -87,9 +87,6 @@ void test()
archetypes::gettable_socket_option<double> gettable_socket_option3;
archetypes::io_control_command io_control_command;
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
// basic_datagram_socket constructors.
@@ -105,8 +102,19 @@ void test()
ip::icmp::socket socket6(ioc, ip::icmp::v4(), native_socket1);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
ip::icmp::socket socket7(ioc_ex);
ip::icmp::socket socket8(ioc_ex, ip::icmp::v4());
ip::icmp::socket socket9(ioc_ex, ip::icmp::v6());
ip::icmp::socket socket10(ioc_ex, ip::icmp::endpoint(ip::icmp::v4(), 0));
ip::icmp::socket socket11(ioc_ex, ip::icmp::endpoint(ip::icmp::v6(), 0));
#if !defined(ASIO_WINDOWS_RUNTIME)
ip::icmp::socket::native_handle_type native_socket2
= ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
ip::icmp::socket socket12(ioc_ex, ip::icmp::v4(), native_socket2);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
#if defined(ASIO_HAS_MOVE)
ip::icmp::socket socket7(std::move(socket6));
ip::icmp::socket socket13(std::move(socket6));
#endif // defined(ASIO_HAS_MOVE)
// basic_datagram_socket operators.
@@ -118,11 +126,6 @@ void test()
// basic_io_object functions.
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::icmp::socket::executor_type ex = socket1.get_executor();
(void)ex;
@@ -131,9 +134,9 @@ void test()
ip::icmp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
(void)lowest_layer;
const ip::icmp::socket& socket8 = socket1;
const ip::icmp::socket& socket14 = socket1;
const ip::icmp::socket::lowest_layer_type& lowest_layer2
= socket8.lowest_layer();
= socket14.lowest_layer();
(void)lowest_layer2;
socket1.open(ip::icmp::v4());
@@ -142,12 +145,12 @@ void test()
socket1.open(ip::icmp::v6(), ec);
#if !defined(ASIO_WINDOWS_RUNTIME)
ip::icmp::socket::native_handle_type native_socket2
= ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
socket1.assign(ip::icmp::v4(), native_socket2);
ip::icmp::socket::native_handle_type native_socket3
= ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
socket1.assign(ip::icmp::v4(), native_socket3, ec);
socket1.assign(ip::icmp::v4(), native_socket3);
ip::icmp::socket::native_handle_type native_socket4
= ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
socket1.assign(ip::icmp::v4(), native_socket4, ec);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
bool is_open = socket1.is_open();
@@ -159,9 +162,9 @@ void test()
socket1.release();
socket1.release(ec);
ip::icmp::socket::native_handle_type native_socket4
ip::icmp::socket::native_handle_type native_socket5
= socket1.native_handle();
(void)native_socket4;
(void)native_socket5;
socket1.cancel();
socket1.cancel(ec);
@@ -194,14 +197,6 @@ void test()
(void)i1;
int i2 = socket1.async_connect(ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d1 = socket1.async_connect(
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
(void)d1;
double d2 = socket1.async_connect(
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.set_option(settable_socket_option1);
socket1.set_option(settable_socket_option1, ec);
@@ -231,10 +226,14 @@ void test()
socket1.native_non_blocking(false, ec);
ip::icmp::endpoint endpoint1 = socket1.local_endpoint();
(void)endpoint1;
ip::icmp::endpoint endpoint2 = socket1.local_endpoint(ec);
(void)endpoint2;
ip::icmp::endpoint endpoint3 = socket1.remote_endpoint();
(void)endpoint3;
ip::icmp::endpoint endpoint4 = socket1.remote_endpoint(ec);
(void)endpoint4;
socket1.shutdown(socket_base::shutdown_both);
socket1.shutdown(socket_base::shutdown_both, ec);
@@ -269,21 +268,6 @@ void test()
(void)i7;
int i8 = socket1.async_send(null_buffers(), in_flags, lazy);
(void)i8;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = socket1.async_send(buffer(mutable_char_buffer), dlazy);
(void)d3;
double d4 = socket1.async_send(buffer(const_char_buffer), dlazy);
(void)d4;
double d5 = socket1.async_send(null_buffers(), dlazy);
(void)d5;
double d6 = socket1.async_send(
buffer(mutable_char_buffer), in_flags, dlazy);
(void)d6;
double d7 = socket1.async_send(buffer(const_char_buffer), in_flags, dlazy);
(void)d7;
double d8 = socket1.async_send(null_buffers(), in_flags, dlazy);
(void)d8;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.send_to(buffer(mutable_char_buffer),
ip::icmp::endpoint(ip::icmp::v4(), 0));
@@ -382,44 +366,6 @@ void test()
int i20 = socket1.async_send_to(null_buffers(),
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
(void)i20;
#if !defined(ASIO_NO_DEPRECATED)
double d9 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
(void)d9;
double d10 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
(void)d10;
double d11 = socket1.async_send_to(buffer(const_char_buffer),
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
(void)d11;
double d12 = socket1.async_send_to(buffer(const_char_buffer),
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
(void)d12;
double d13 = socket1.async_send_to(null_buffers(),
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
(void)d13;
double d14 = socket1.async_send_to(null_buffers(),
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
(void)d14;
double d15 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
(void)d15;
double d16 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
(void)d16;
double d17 = socket1.async_send_to(buffer(const_char_buffer),
ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
(void)d17;
double d18 = socket1.async_send_to(buffer(const_char_buffer),
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
(void)d18;
double d19 = socket1.async_send_to(null_buffers(),
ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
(void)d19;
double d20 = socket1.async_send_to(null_buffers(),
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
(void)d20;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.receive(buffer(mutable_char_buffer));
socket1.receive(null_buffers());
@@ -442,17 +388,6 @@ void test()
(void)i23;
int i24 = socket1.async_receive(null_buffers(), in_flags, lazy);
(void)i24;
#if !defined(ASIO_NO_DEPRECATED)
double d21 = socket1.async_receive(buffer(mutable_char_buffer), dlazy);
(void)d21;
double d22 = socket1.async_receive(null_buffers(), dlazy);
(void)d22;
double d23 = socket1.async_receive(buffer(mutable_char_buffer),
in_flags, dlazy);
(void)d23;
double d24 = socket1.async_receive(null_buffers(), in_flags, dlazy);
(void)d24;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::icmp::endpoint endpoint;
socket1.receive_from(buffer(mutable_char_buffer), endpoint);
@@ -482,20 +417,6 @@ void test()
int i28 = socket1.async_receive_from(null_buffers(),
endpoint, in_flags, lazy);
(void)i28;
#if !defined(ASIO_NO_DEPRECATED)
double d25 = socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, dlazy);
(void)d25;
double d26 = socket1.async_receive_from(null_buffers(),
endpoint, dlazy);
(void)d26;
double d27 = socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, in_flags, dlazy);
(void)d27;
double d28 = socket1.async_receive_from(null_buffers(),
endpoint, in_flags, dlazy);
(void)d28;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{
@@ -533,10 +454,8 @@ void test()
try
{
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
#if !defined(ASIO_NO_DEPRECATED)
ip::icmp::resolver::query q(ip::icmp::v4(), "localhost", "0");
@@ -546,25 +465,21 @@ void test()
// basic_resolver constructors.
ip::icmp::resolver resolver(ioc);
ip::icmp::resolver resolver2(ioc_ex);
#if defined(ASIO_HAS_MOVE)
ip::icmp::resolver resolver2(std::move(resolver));
ip::icmp::resolver resolver3(std::move(resolver));
#endif // defined(ASIO_HAS_MOVE)
// basic_resolver operators.
#if defined(ASIO_HAS_MOVE)
resolver = ip::icmp::resolver(ioc);
resolver = std::move(resolver2);
resolver = std::move(resolver3);
#endif // defined(ASIO_HAS_MOVE)
// basic_io_object functions.
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = resolver.get_io_context();
(void)ioc_ref;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::icmp::resolver::executor_type ex = resolver.get_executor();
(void)ex;
@@ -620,55 +535,30 @@ void test()
resolver.async_resolve(q, resolve_handler());
int i1 = resolver.async_resolve(q, lazy);
(void)i1;
double d1 = resolver.async_resolve(q, dlazy);
(void)d1;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "", resolve_handler());
int i2 = resolver.async_resolve("", "", lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d2 = resolver.async_resolve("", "", dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "",
ip::icmp::resolver::flags(), resolve_handler());
int i3 = resolver.async_resolve("", "",
ip::icmp::resolver::flags(), lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = resolver.async_resolve("", "",
ip::icmp::resolver::flags(), dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::icmp::v4(), "", "", resolve_handler());
int i4 = resolver.async_resolve(ip::icmp::v4(), "", "", lazy);
(void)i4;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = resolver.async_resolve(ip::icmp::v4(), "", "", dlazy);
(void)d4;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::icmp::v4(),
"", "", ip::icmp::resolver::flags(), resolve_handler());
int i5 = resolver.async_resolve(ip::icmp::v4(),
"", "", ip::icmp::resolver::flags(), lazy);
(void)i5;
#if !defined(ASIO_NO_DEPRECATED)
double d5 = resolver.async_resolve(ip::icmp::v4(),
"", "", ip::icmp::resolver::flags(), dlazy);
(void)d5;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(e, resolve_handler());
int i6 = resolver.async_resolve(e, lazy);
(void)i6;
#if !defined(ASIO_NO_DEPRECATED)
double d6 = resolver.async_resolve(e, dlazy);
(void)d6;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{

View File

@@ -2,7 +2,7 @@
// multicast.cpp
// ~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// network_v4.cpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -95,15 +95,15 @@ void test()
net1 = ip::make_network_v4("10.0.0.0/8", ec);
net1 = ip::make_network_v4(s1);
net1 = ip::make_network_v4(s1, ec);
#if defined(ASIO_HAS_STD_STRING_VIEW)
# if defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_value("10.0.0.0/8");
# else // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
#if defined(ASIO_HAS_STRING_VIEW)
# if defined(ASIO_HAS_STD_STRING_VIEW)
std::string_view string_view_value("10.0.0.0/8");
# elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_value("10.0.0.0/8");
# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
net1 = ip::make_network_v4(string_view_value);
net1 = ip::make_network_v4(string_view_value, ec);
#endif // defined(ASIO_HAS_STD_STRING_VIEW)
#endif // defined(ASIO_HAS_STRING_VIEW)
// network_v4 I/O.

View File

@@ -2,7 +2,7 @@
// network_v6.cpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -87,15 +87,15 @@ void test()
net1 = ip::make_network_v6("10.0.0.0/8", ec);
net1 = ip::make_network_v6(s1);
net1 = ip::make_network_v6(s1, ec);
#if defined(ASIO_HAS_STD_STRING_VIEW)
# if defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_value("0::0/8");
# else // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
#if defined(ASIO_HAS_STRING_VIEW)
# if defined(ASIO_HAS_STD_STRING_VIEW)
std::string_view string_view_value("0::0/8");
# elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
std::experimental::string_view string_view_value("0::0/8");
# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
net1 = ip::make_network_v6(string_view_value);
net1 = ip::make_network_v6(string_view_value, ec);
#endif // defined(ASIO_HAS_STD_STRING_VIEW)
#endif // defined(ASIO_STD_STRING_VIEW)
// network_v6 I/O.

View File

@@ -2,7 +2,7 @@
// resolver_query_base.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -1,25 +0,0 @@
//
// resolver_service.cpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Disable autolinking for unit tests.
#if !defined(BOOST_ALL_NO_LIB)
#define BOOST_ALL_NO_LIB 1
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/ip/resolver_service.hpp"
#include "../unit_test.hpp"
ASIO_TEST_SUITE
(
"ip/resolver_service",
ASIO_TEST_CASE(null_test)
)

View File

@@ -2,7 +2,7 @@
// tcp.cpp
// ~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -25,7 +25,6 @@
#include "asio/write.hpp"
#include "../unit_test.hpp"
#include "../archetypes/async_result.hpp"
#include "../archetypes/deprecated_async_result.hpp"
#include "../archetypes/gettable_socket_option.hpp"
#include "../archetypes/io_control_command.hpp"
#include "../archetypes/settable_socket_option.hpp"
@@ -218,6 +217,7 @@ void test()
try
{
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
char mutable_char_buffer[128] = "";
const char const_char_buffer[128] = "";
array<asio::mutable_buffer, 2> mutable_buffers = {{
@@ -235,9 +235,6 @@ void test()
archetypes::gettable_socket_option<double> gettable_socket_option3;
archetypes::io_control_command io_control_command;
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
// basic_stream_socket constructors.
@@ -253,8 +250,19 @@ void test()
ip::tcp::socket socket6(ioc, ip::tcp::v4(), native_socket1);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
ip::tcp::socket socket7(ioc_ex);
ip::tcp::socket socket8(ioc_ex, ip::tcp::v4());
ip::tcp::socket socket9(ioc_ex, ip::tcp::v6());
ip::tcp::socket socket10(ioc_ex, ip::tcp::endpoint(ip::tcp::v4(), 0));
ip::tcp::socket socket11(ioc_ex, ip::tcp::endpoint(ip::tcp::v6(), 0));
#if !defined(ASIO_WINDOWS_RUNTIME)
ip::tcp::socket::native_handle_type native_socket2
= ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
ip::tcp::socket socket12(ioc_ex, ip::tcp::v4(), native_socket2);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
#if defined(ASIO_HAS_MOVE)
ip::tcp::socket socket7(std::move(socket5));
ip::tcp::socket socket13(std::move(socket5));
#endif // defined(ASIO_HAS_MOVE)
// basic_stream_socket operators.
@@ -266,11 +274,6 @@ void test()
// basic_io_object functions.
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::tcp::socket::executor_type ex = socket1.get_executor();
(void)ex;
@@ -279,9 +282,9 @@ void test()
ip::tcp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
(void)lowest_layer;
const ip::tcp::socket& socket8 = socket1;
const ip::tcp::socket& socket14 = socket1;
const ip::tcp::socket::lowest_layer_type& lowest_layer2
= socket8.lowest_layer();
= socket14.lowest_layer();
(void)lowest_layer2;
socket1.open(ip::tcp::v4());
@@ -290,12 +293,12 @@ void test()
socket1.open(ip::tcp::v6(), ec);
#if !defined(ASIO_WINDOWS_RUNTIME)
ip::tcp::socket::native_handle_type native_socket2
= ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
socket1.assign(ip::tcp::v4(), native_socket2);
ip::tcp::socket::native_handle_type native_socket3
= ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
socket1.assign(ip::tcp::v4(), native_socket3, ec);
socket1.assign(ip::tcp::v4(), native_socket3);
ip::tcp::socket::native_handle_type native_socket4
= ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
socket1.assign(ip::tcp::v4(), native_socket4, ec);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
bool is_open = socket1.is_open();
@@ -307,9 +310,9 @@ void test()
socket1.release();
socket1.release(ec);
ip::tcp::socket::native_handle_type native_socket4
ip::tcp::socket::native_handle_type native_socket5
= socket1.native_handle();
(void)native_socket4;
(void)native_socket5;
socket1.cancel();
socket1.cancel(ec);
@@ -342,14 +345,6 @@ void test()
(void)i1;
int i2 = socket1.async_connect(ip::tcp::endpoint(ip::tcp::v6(), 0), lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d1 = socket1.async_connect(
ip::tcp::endpoint(ip::tcp::v4(), 0), dlazy);
(void)d1;
double d2 = socket1.async_connect(
ip::tcp::endpoint(ip::tcp::v6(), 0), dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.set_option(settable_socket_option1);
socket1.set_option(settable_socket_option1, ec);
@@ -379,10 +374,14 @@ void test()
socket1.native_non_blocking(false, ec);
ip::tcp::endpoint endpoint1 = socket1.local_endpoint();
(void)endpoint1;
ip::tcp::endpoint endpoint2 = socket1.local_endpoint(ec);
(void)endpoint2;
ip::tcp::endpoint endpoint3 = socket1.remote_endpoint();
(void)endpoint3;
ip::tcp::endpoint endpoint4 = socket1.remote_endpoint(ec);
(void)endpoint4;
socket1.shutdown(socket_base::shutdown_both);
socket1.shutdown(socket_base::shutdown_both, ec);
@@ -393,10 +392,6 @@ void test()
socket1.async_wait(socket_base::wait_read, wait_handler());
int i3 = socket1.async_wait(socket_base::wait_write, lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = socket1.async_wait(socket_base::wait_write, dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
// basic_stream_socket functions.
@@ -446,29 +441,6 @@ void test()
(void)i12;
int i13 = socket1.async_send(null_buffers(), in_flags, lazy);
(void)i13;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = socket1.async_send(buffer(mutable_char_buffer), dlazy);
(void)d4;
double d5 = socket1.async_send(buffer(const_char_buffer), dlazy);
(void)d5;
double d6 = socket1.async_send(mutable_buffers, dlazy);
(void)d6;
double d7 = socket1.async_send(const_buffers, dlazy);
(void)d7;
double d8 = socket1.async_send(null_buffers(), dlazy);
(void)d8;
double d9 = socket1.async_send(
buffer(mutable_char_buffer), in_flags, dlazy);
(void)d9;
double d10 = socket1.async_send(buffer(const_char_buffer), in_flags, dlazy);
(void)d10;
double d11 = socket1.async_send(mutable_buffers, in_flags, dlazy);
(void)d11;
double d12 = socket1.async_send(const_buffers, in_flags, dlazy);
(void)d12;
double d13 = socket1.async_send(null_buffers(), in_flags, dlazy);
(void)d13;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.receive(buffer(mutable_char_buffer));
socket1.receive(mutable_buffers);
@@ -500,21 +472,6 @@ void test()
(void)i18;
int i19 = socket1.async_receive(null_buffers(), in_flags, lazy);
(void)i19;
#if !defined(ASIO_NO_DEPRECATED)
double d14 = socket1.async_receive(buffer(mutable_char_buffer), dlazy);
(void)d14;
double d15 = socket1.async_receive(mutable_buffers, dlazy);
(void)d15;
double d16 = socket1.async_receive(null_buffers(), dlazy);
(void)d16;
double d17 = socket1.async_receive(buffer(mutable_char_buffer), in_flags,
dlazy);
(void)d17;
double d18 = socket1.async_receive(mutable_buffers, in_flags, dlazy);
(void)d18;
double d19 = socket1.async_receive(null_buffers(), in_flags, dlazy);
(void)d19;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.write_some(buffer(mutable_char_buffer));
socket1.write_some(buffer(const_char_buffer));
@@ -542,18 +499,6 @@ void test()
(void)i23;
int i24 = socket1.async_write_some(null_buffers(), lazy);
(void)i24;
#if !defined(ASIO_NO_DEPRECATED)
double d20 = socket1.async_write_some(buffer(mutable_char_buffer), dlazy);
(void)d20;
double d21 = socket1.async_write_some(buffer(const_char_buffer), dlazy);
(void)d21;
double d22 = socket1.async_write_some(mutable_buffers, dlazy);
(void)d22;
double d23 = socket1.async_write_some(const_buffers, dlazy);
(void)d23;
double d24 = socket1.async_write_some(null_buffers(), dlazy);
(void)d24;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.read_some(buffer(mutable_char_buffer));
socket1.read_some(mutable_buffers);
@@ -571,14 +516,6 @@ void test()
(void)i26;
int i27 = socket1.async_read_some(null_buffers(), lazy);
(void)i27;
#if !defined(ASIO_NO_DEPRECATED)
double d25 = socket1.async_read_some(buffer(mutable_char_buffer), dlazy);
(void)d25;
double d26 = socket1.async_read_some(mutable_buffers, dlazy);
(void)d26;
double d27 = socket1.async_read_some(null_buffers(), dlazy);
(void)d27;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{
@@ -802,7 +739,10 @@ void test()
try
{
io_context ioc;
ip::tcp::socket peer_socket(ioc);
const io_context::executor_type ioc_ex = ioc.get_executor();
ip::tcp::socket peer_socket1(ioc);
asio::basic_stream_socket<ip::tcp,
io_context::executor_type> peer_socket2(ioc);
ip::tcp::endpoint peer_endpoint;
archetypes::settable_socket_option<void> settable_socket_option1;
archetypes::settable_socket_option<int> settable_socket_option2;
@@ -812,9 +752,6 @@ void test()
archetypes::gettable_socket_option<double> gettable_socket_option3;
archetypes::io_control_command io_control_command;
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
// basic_socket_acceptor constructors.
@@ -830,8 +767,19 @@ void test()
ip::tcp::acceptor acceptor6(ioc, ip::tcp::v4(), native_acceptor1);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
ip::tcp::acceptor acceptor7(ioc_ex);
ip::tcp::acceptor acceptor8(ioc_ex, ip::tcp::v4());
ip::tcp::acceptor acceptor9(ioc_ex, ip::tcp::v6());
ip::tcp::acceptor acceptor10(ioc_ex, ip::tcp::endpoint(ip::tcp::v4(), 0));
ip::tcp::acceptor acceptor11(ioc_ex, ip::tcp::endpoint(ip::tcp::v6(), 0));
#if !defined(ASIO_WINDOWS_RUNTIME)
ip::tcp::acceptor::native_handle_type native_acceptor2
= ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
ip::tcp::acceptor acceptor12(ioc_ex, ip::tcp::v4(), native_acceptor2);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
#if defined(ASIO_HAS_MOVE)
ip::tcp::acceptor acceptor7(std::move(acceptor5));
ip::tcp::acceptor acceptor13(std::move(acceptor5));
#endif // defined(ASIO_HAS_MOVE)
// basic_socket_acceptor operators.
@@ -843,11 +791,6 @@ void test()
// basic_io_object functions.
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = acceptor1.get_io_context();
(void)ioc_ref;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::tcp::acceptor::executor_type ex = acceptor1.get_executor();
(void)ex;
@@ -859,12 +802,12 @@ void test()
acceptor1.open(ip::tcp::v6(), ec);
#if !defined(ASIO_WINDOWS_RUNTIME)
ip::tcp::acceptor::native_handle_type native_acceptor2
= ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
acceptor1.assign(ip::tcp::v4(), native_acceptor2);
ip::tcp::acceptor::native_handle_type native_acceptor3
= ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
acceptor1.assign(ip::tcp::v4(), native_acceptor3, ec);
acceptor1.assign(ip::tcp::v4(), native_acceptor3);
ip::tcp::acceptor::native_handle_type native_acceptor4
= ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
acceptor1.assign(ip::tcp::v4(), native_acceptor4, ec);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
bool is_open = acceptor1.is_open();
@@ -876,9 +819,9 @@ void test()
acceptor1.release();
acceptor1.release(ec);
ip::tcp::acceptor::native_handle_type native_acceptor4
ip::tcp::acceptor::native_handle_type native_acceptor5
= acceptor1.native_handle();
(void)native_acceptor4;
(void)native_acceptor5;
acceptor1.cancel();
acceptor1.cancel(ec);
@@ -916,7 +859,9 @@ void test()
acceptor1.native_non_blocking(false, ec);
ip::tcp::endpoint endpoint1 = acceptor1.local_endpoint();
(void)endpoint1;
ip::tcp::endpoint endpoint2 = acceptor1.local_endpoint(ec);
(void)endpoint2;
acceptor1.wait(socket_base::wait_read);
acceptor1.wait(socket_base::wait_write, ec);
@@ -924,36 +869,46 @@ void test()
acceptor1.async_wait(socket_base::wait_read, wait_handler());
int i1 = acceptor1.async_wait(socket_base::wait_write, lazy);
(void)i1;
#if !defined(ASIO_NO_DEPRECATED)
double d1 = acceptor1.async_wait(socket_base::wait_write, dlazy);
(void)d1;
#endif // !defined(ASIO_NO_DEPRECATED)
acceptor1.accept(peer_socket);
acceptor1.accept(peer_socket, ec);
acceptor1.accept(peer_socket, peer_endpoint);
acceptor1.accept(peer_socket, peer_endpoint, ec);
acceptor1.accept(peer_socket1);
acceptor1.accept(peer_socket1, ec);
acceptor1.accept(peer_socket1, peer_endpoint);
acceptor1.accept(peer_socket1, peer_endpoint, ec);
acceptor1.accept(peer_socket2);
acceptor1.accept(peer_socket2, ec);
acceptor1.accept(peer_socket2, peer_endpoint);
acceptor1.accept(peer_socket2, peer_endpoint, ec);
#if defined(ASIO_HAS_MOVE)
peer_socket = acceptor1.accept();
peer_socket = acceptor1.accept(ioc);
peer_socket = acceptor1.accept(peer_endpoint);
peer_socket = acceptor1.accept(ioc, peer_endpoint);
(void)peer_socket;
peer_socket1 = acceptor1.accept();
peer_socket1 = acceptor1.accept(ioc);
peer_socket1 = acceptor1.accept(ioc_ex);
peer_socket1 = acceptor1.accept(peer_endpoint);
peer_socket1 = acceptor1.accept(ioc, peer_endpoint);
peer_socket1 = acceptor1.accept(ioc_ex, peer_endpoint);
(void)peer_socket1;
peer_socket2 = acceptor1.accept(ioc);
peer_socket2 = acceptor1.accept(ioc_ex);
peer_socket2 = acceptor1.accept(ioc, peer_endpoint);
peer_socket2 = acceptor1.accept(ioc_ex, peer_endpoint);
(void)peer_socket2;
#endif // defined(ASIO_HAS_MOVE)
acceptor1.async_accept(peer_socket, accept_handler());
acceptor1.async_accept(peer_socket, peer_endpoint, accept_handler());
int i2 = acceptor1.async_accept(peer_socket, lazy);
acceptor1.async_accept(peer_socket1, accept_handler());
acceptor1.async_accept(peer_socket1, peer_endpoint, accept_handler());
int i2 = acceptor1.async_accept(peer_socket1, lazy);
(void)i2;
int i3 = acceptor1.async_accept(peer_socket, peer_endpoint, lazy);
int i3 = acceptor1.async_accept(peer_socket1, peer_endpoint, lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d2 = acceptor1.async_accept(peer_socket, dlazy);
(void)d2;
double d3 = acceptor1.async_accept(peer_socket, peer_endpoint, dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
acceptor1.async_accept(peer_socket2, accept_handler());
acceptor1.async_accept(peer_socket2, peer_endpoint, accept_handler());
int i4 = acceptor1.async_accept(peer_socket2, lazy);
(void)i4;
int i5 = acceptor1.async_accept(peer_socket2, peer_endpoint, lazy);
(void)i5;
#if defined(ASIO_HAS_MOVE)
acceptor1.async_accept(move_accept_handler());
@@ -1069,6 +1024,7 @@ private:
#endif // defined(ASIO_HAS_MOVE)
};
#if !defined(ASIO_NO_DEPRECATED)
struct legacy_resolve_handler
{
legacy_resolve_handler() {}
@@ -1080,6 +1036,7 @@ private:
legacy_resolve_handler(const legacy_resolve_handler&);
#endif // defined(ASIO_HAS_MOVE)
};
#endif // !defined(ASIO_NO_DEPRECATED)
void test()
{
@@ -1089,10 +1046,8 @@ void test()
try
{
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
#if !defined(ASIO_NO_DEPRECATED)
ip::tcp::resolver::query q(ip::tcp::v4(), "localhost", "0");
@@ -1102,25 +1057,21 @@ void test()
// basic_resolver constructors.
ip::tcp::resolver resolver(ioc);
ip::tcp::resolver resolver2(ioc_ex);
#if defined(ASIO_HAS_MOVE)
ip::tcp::resolver resolver2(std::move(resolver));
ip::tcp::resolver resolver3(std::move(resolver));
#endif // defined(ASIO_HAS_MOVE)
// basic_resolver operators.
#if defined(ASIO_HAS_MOVE)
resolver = ip::tcp::resolver(ioc);
resolver = std::move(resolver2);
resolver = std::move(resolver3);
#endif // defined(ASIO_HAS_MOVE)
// basic_io_object functions.
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = resolver.get_io_context();
(void)ioc_ref;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::tcp::resolver::executor_type ex = resolver.get_executor();
(void)ex;
@@ -1177,62 +1128,48 @@ void test()
resolver.async_resolve(q, legacy_resolve_handler());
int i1 = resolver.async_resolve(q, lazy);
(void)i1;
double d1 = resolver.async_resolve(q, dlazy);
(void)d1;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "", resolve_handler());
#if !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "", legacy_resolve_handler());
#endif // !defined(ASIO_NO_DEPRECATED)
int i2 = resolver.async_resolve("", "", lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d2 = resolver.async_resolve("", "", dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "",
ip::tcp::resolver::flags(), resolve_handler());
#if !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "",
ip::tcp::resolver::flags(), legacy_resolve_handler());
#endif // !defined(ASIO_NO_DEPRECATED)
int i3 = resolver.async_resolve("", "",
ip::tcp::resolver::flags(), lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = resolver.async_resolve("", "",
ip::tcp::resolver::flags(), dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::tcp::v4(), "", "", resolve_handler());
#if !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::tcp::v4(), "", "", legacy_resolve_handler());
#endif // !defined(ASIO_NO_DEPRECATED)
int i4 = resolver.async_resolve(ip::tcp::v4(), "", "", lazy);
(void)i4;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = resolver.async_resolve(ip::tcp::v4(), "", "", dlazy);
(void)d4;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::tcp::v4(),
"", "", ip::tcp::resolver::flags(), resolve_handler());
#if !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::tcp::v4(),
"", "", ip::tcp::resolver::flags(), legacy_resolve_handler());
#endif // !defined(ASIO_NO_DEPRECATED)
int i5 = resolver.async_resolve(ip::tcp::v4(),
"", "", ip::tcp::resolver::flags(), lazy);
(void)i5;
#if !defined(ASIO_NO_DEPRECATED)
double d5 = resolver.async_resolve(ip::tcp::v4(),
"", "", ip::tcp::resolver::flags(), dlazy);
(void)d5;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(e, resolve_handler());
#if !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(e, legacy_resolve_handler());
#endif // !defined(ASIO_NO_DEPRECATED)
int i6 = resolver.async_resolve(e, lazy);
(void)i6;
#if !defined(ASIO_NO_DEPRECATED)
double d6 = resolver.async_resolve(e, dlazy);
(void)d6;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{
@@ -1352,11 +1289,7 @@ void test()
(void)static_cast<std::streambuf*>(ios1.rdbuf());
#if defined(ASIO_ENABLE_OLD_SERVICES)
basic_socket<ip::tcp, stream_socket_service<ip::tcp> >& sref = ios1.socket();
#else // defined(ASIO_ENABLE_OLD_SERVICES)
basic_socket<ip::tcp>& sref = ios1.socket();
#endif // defined(ASIO_ENABLE_OLD_SERVICES)
(void)sref;
asio::error_code ec = ios1.error();

View File

@@ -2,7 +2,7 @@
// udp.cpp
// ~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -20,7 +20,6 @@
#include "asio/io_context.hpp"
#include "../unit_test.hpp"
#include "../archetypes/async_result.hpp"
#include "../archetypes/deprecated_async_result.hpp"
#include "../archetypes/gettable_socket_option.hpp"
#include "../archetypes/io_control_command.hpp"
#include "../archetypes/settable_socket_option.hpp"
@@ -92,6 +91,7 @@ void test()
try
{
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
char mutable_char_buffer[128] = "";
const char const_char_buffer[128] = "";
socket_base::message_flags in_flags = 0;
@@ -103,9 +103,6 @@ void test()
archetypes::gettable_socket_option<double> gettable_socket_option3;
archetypes::io_control_command io_control_command;
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
// basic_datagram_socket constructors.
@@ -121,8 +118,19 @@ void test()
ip::udp::socket socket6(ioc, ip::udp::v4(), native_socket1);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
ip::udp::socket socket7(ioc_ex);
ip::udp::socket socket8(ioc_ex, ip::udp::v4());
ip::udp::socket socket9(ioc_ex, ip::udp::v6());
ip::udp::socket socket10(ioc_ex, ip::udp::endpoint(ip::udp::v4(), 0));
ip::udp::socket socket11(ioc_ex, ip::udp::endpoint(ip::udp::v6(), 0));
#if !defined(ASIO_WINDOWS_RUNTIME)
ip::udp::socket::native_handle_type native_socket2
= ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
ip::udp::socket socket12(ioc_ex, ip::udp::v4(), native_socket2);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
#if defined(ASIO_HAS_MOVE)
ip::udp::socket socket7(std::move(socket6));
ip::udp::socket socket13(std::move(socket6));
#endif // defined(ASIO_HAS_MOVE)
// basic_datagram_socket operators.
@@ -134,11 +142,6 @@ void test()
// basic_io_object functions.
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::udp::socket::executor_type ex = socket1.get_executor();
(void)ex;
@@ -147,9 +150,9 @@ void test()
ip::udp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
(void)lowest_layer;
const ip::udp::socket& socket8 = socket1;
const ip::udp::socket& socket14 = socket1;
const ip::udp::socket::lowest_layer_type& lowest_layer2
= socket8.lowest_layer();
= socket14.lowest_layer();
(void)lowest_layer2;
socket1.open(ip::udp::v4());
@@ -158,12 +161,12 @@ void test()
socket1.open(ip::udp::v6(), ec);
#if !defined(ASIO_WINDOWS_RUNTIME)
ip::udp::socket::native_handle_type native_socket2
= ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
socket1.assign(ip::udp::v4(), native_socket2);
ip::udp::socket::native_handle_type native_socket3
= ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
socket1.assign(ip::udp::v4(), native_socket3, ec);
socket1.assign(ip::udp::v4(), native_socket3);
ip::udp::socket::native_handle_type native_socket4
= ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
socket1.assign(ip::udp::v4(), native_socket4, ec);
#endif // !defined(ASIO_WINDOWS_RUNTIME)
bool is_open = socket1.is_open();
@@ -175,9 +178,9 @@ void test()
socket1.release();
socket1.release(ec);
ip::udp::socket::native_handle_type native_socket4
ip::udp::socket::native_handle_type native_socket5
= socket1.native_handle();
(void)native_socket4;
(void)native_socket5;
socket1.cancel();
socket1.cancel(ec);
@@ -210,14 +213,6 @@ void test()
(void)i1;
int i2 = socket1.async_connect(ip::udp::endpoint(ip::udp::v6(), 0), lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d1 = socket1.async_connect(
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
(void)d1;
double d2 = socket1.async_connect(
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.set_option(settable_socket_option1);
socket1.set_option(settable_socket_option1, ec);
@@ -247,10 +242,14 @@ void test()
socket1.native_non_blocking(false, ec);
ip::udp::endpoint endpoint1 = socket1.local_endpoint();
(void)endpoint1;
ip::udp::endpoint endpoint2 = socket1.local_endpoint(ec);
(void)endpoint2;
ip::udp::endpoint endpoint3 = socket1.remote_endpoint();
(void)endpoint3;
ip::udp::endpoint endpoint4 = socket1.remote_endpoint(ec);
(void)endpoint4;
socket1.shutdown(socket_base::shutdown_both);
socket1.shutdown(socket_base::shutdown_both, ec);
@@ -261,10 +260,6 @@ void test()
socket1.async_wait(socket_base::wait_read, wait_handler());
int i3 = socket1.async_wait(socket_base::wait_write, lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = socket1.async_wait(socket_base::wait_write, dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
// basic_datagram_socket functions.
@@ -296,21 +291,6 @@ void test()
(void)i8;
int i9 = socket1.async_send(null_buffers(), in_flags, lazy);
(void)i9;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = socket1.async_send(buffer(mutable_char_buffer), dlazy);
(void)d4;
double d5 = socket1.async_send(buffer(const_char_buffer), dlazy);
(void)d5;
double d6 = socket1.async_send(null_buffers(), dlazy);
(void)d6;
double d7 = socket1.async_send(
buffer(mutable_char_buffer), in_flags, dlazy);
(void)d7;
double d8 = socket1.async_send(buffer(const_char_buffer), in_flags, dlazy);
(void)d8;
double d9 = socket1.async_send(null_buffers(), in_flags, dlazy);
(void)d9;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.send_to(buffer(mutable_char_buffer),
ip::udp::endpoint(ip::udp::v4(), 0));
@@ -409,44 +389,6 @@ void test()
int i21 = socket1.async_send_to(null_buffers(),
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, lazy);
(void)i21;
#if !defined(ASIO_NO_DEPRECATED)
double d10 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
(void)d10;
double d11 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
(void)d11;
double d12 = socket1.async_send_to(buffer(const_char_buffer),
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
(void)d12;
double d13 = socket1.async_send_to(buffer(const_char_buffer),
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
(void)d13;
double d14 = socket1.async_send_to(null_buffers(),
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
(void)d14;
double d15 = socket1.async_send_to(null_buffers(),
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
(void)d15;
double d16 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::udp::endpoint(ip::udp::v4(), 0), in_flags, dlazy);
(void)d16;
double d17 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, dlazy);
(void)d17;
double d18 = socket1.async_send_to(buffer(const_char_buffer),
ip::udp::endpoint(ip::udp::v4(), 0), in_flags, dlazy);
(void)d18;
double d19 = socket1.async_send_to(buffer(const_char_buffer),
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, dlazy);
(void)d19;
double d20 = socket1.async_send_to(null_buffers(),
ip::udp::endpoint(ip::udp::v4(), 0), in_flags, dlazy);
(void)d20;
double d21 = socket1.async_send_to(null_buffers(),
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, dlazy);
(void)d21;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.receive(buffer(mutable_char_buffer));
socket1.receive(null_buffers());
@@ -469,17 +411,6 @@ void test()
(void)i24;
int i25 = socket1.async_receive(null_buffers(), in_flags, lazy);
(void)i25;
#if !defined(ASIO_NO_DEPRECATED)
double d22 = socket1.async_receive(buffer(mutable_char_buffer), dlazy);
(void)d22;
double d23 = socket1.async_receive(null_buffers(), dlazy);
(void)d23;
double d24 = socket1.async_receive(buffer(mutable_char_buffer),
in_flags, dlazy);
(void)d24;
double d25 = socket1.async_receive(null_buffers(), in_flags, dlazy);
(void)d25;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::udp::endpoint endpoint;
socket1.receive_from(buffer(mutable_char_buffer), endpoint);
@@ -509,20 +440,6 @@ void test()
int i29 = socket1.async_receive_from(null_buffers(),
endpoint, in_flags, lazy);
(void)i29;
#if !defined(ASIO_NO_DEPRECATED)
double d26 = socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, dlazy);
(void)d26;
double d27 = socket1.async_receive_from(null_buffers(),
endpoint, dlazy);
(void)d27;
double d28 = socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, in_flags, dlazy);
(void)d28;
double d29 = socket1.async_receive_from(null_buffers(),
endpoint, in_flags, dlazy);
(void)d29;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{
@@ -631,10 +548,8 @@ void test()
try
{
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
#if !defined(ASIO_NO_DEPRECATED)
ip::udp::resolver::query q(ip::udp::v4(), "localhost", "0");
@@ -644,25 +559,21 @@ void test()
// basic_resolver constructors.
ip::udp::resolver resolver(ioc);
ip::udp::resolver resolver2(ioc_ex);
#if defined(ASIO_HAS_MOVE)
ip::udp::resolver resolver2(std::move(resolver));
ip::udp::resolver resolver3(std::move(resolver));
#endif // defined(ASIO_HAS_MOVE)
// basic_resolver operators.
#if defined(ASIO_HAS_MOVE)
resolver = ip::udp::resolver(ioc);
resolver = std::move(resolver2);
resolver = std::move(resolver3);
#endif // defined(ASIO_HAS_MOVE)
// basic_io_object functions.
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = resolver.get_io_context();
(void)ioc_ref;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::udp::resolver::executor_type ex = resolver.get_executor();
(void)ex;
@@ -718,55 +629,31 @@ void test()
resolver.async_resolve(q, resolve_handler());
int i1 = resolver.async_resolve(q, lazy);
(void)i1;
double d1 = resolver.async_resolve(q, dlazy);
(void)d1;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "", resolve_handler());
int i2 = resolver.async_resolve("", "", lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d2 = resolver.async_resolve("", "", dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "",
ip::udp::resolver::flags(), resolve_handler());
int i3 = resolver.async_resolve("", "",
ip::udp::resolver::flags(), lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = resolver.async_resolve("", "",
ip::udp::resolver::flags(), dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::udp::v4(), "", "", resolve_handler());
int i4 = resolver.async_resolve(ip::udp::v4(), "", "", lazy);
(void)i4;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = resolver.async_resolve(ip::udp::v4(), "", "", dlazy);
(void)d4;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::udp::v4(),
"", "", ip::udp::resolver::flags(), resolve_handler());
int i5 = resolver.async_resolve(ip::udp::v4(),
"", "", ip::udp::resolver::flags(), lazy);
(void)i5;
#if !defined(ASIO_NO_DEPRECATED)
double d5 = resolver.async_resolve(ip::udp::v4(),
"", "", ip::udp::resolver::flags(), dlazy);
(void)d5;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(e, resolve_handler());
int i6 = resolver.async_resolve(e, lazy);
(void)i6;
#if !defined(ASIO_NO_DEPRECATED)
double d6 = resolver.async_resolve(e, dlazy);
(void)d6;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{

View File

@@ -2,7 +2,7 @@
// unicast.cpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// v6_only.cpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// is_read_buffered.cpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// is_write_buffered.cpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_endpoint.cpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// connect_pair.cpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// datagram_protocol.cpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -52,6 +52,7 @@ void test()
try
{
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
char mutable_char_buffer[128] = "";
const char const_char_buffer[128] = "";
socket_base::message_flags in_flags = 0;
@@ -67,12 +68,13 @@ void test()
int native_socket1 = ::socket(AF_UNIX, SOCK_DGRAM, 0);
dp::socket socket4(ioc, dp(), native_socket1);
// basic_io_object functions.
dp::socket socket5(ioc_ex);
dp::socket socket6(ioc_ex, dp());
dp::socket socket7(ioc_ex, dp::endpoint(""));
int native_socket2 = ::socket(AF_UNIX, SOCK_DGRAM, 0);
dp::socket socket8(ioc_ex, dp(), native_socket2);
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
#endif // !defined(ASIO_NO_DEPRECATED)
// basic_io_object functions.
dp::socket::executor_type ex = socket1.get_executor();
(void)ex;
@@ -85,10 +87,10 @@ void test()
socket1.open(dp());
socket1.open(dp(), ec);
int native_socket2 = ::socket(AF_UNIX, SOCK_DGRAM, 0);
socket1.assign(dp(), native_socket2);
int native_socket3 = ::socket(AF_UNIX, SOCK_DGRAM, 0);
socket1.assign(dp(), native_socket3, ec);
socket1.assign(dp(), native_socket3);
int native_socket4 = ::socket(AF_UNIX, SOCK_DGRAM, 0);
socket1.assign(dp(), native_socket4, ec);
bool is_open = socket1.is_open();
(void)is_open;
@@ -96,8 +98,8 @@ void test()
socket1.close();
socket1.close(ec);
dp::socket::native_handle_type native_socket4 = socket1.native_handle();
(void)native_socket4;
dp::socket::native_handle_type native_socket5 = socket1.native_handle();
(void)native_socket5;
socket1.cancel();
socket1.cancel(ec);
@@ -130,10 +132,14 @@ void test()
socket1.io_control(io_control_command, ec);
dp::endpoint endpoint1 = socket1.local_endpoint();
(void)endpoint1;
dp::endpoint endpoint2 = socket1.local_endpoint(ec);
(void)endpoint2;
dp::endpoint endpoint3 = socket1.remote_endpoint();
(void)endpoint3;
dp::endpoint endpoint4 = socket1.remote_endpoint(ec);
(void)endpoint4;
socket1.shutdown(socket_base::shutdown_both);
socket1.shutdown(socket_base::shutdown_both, ec);

View File

@@ -2,7 +2,7 @@
// stream_protocol.cpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -60,6 +60,7 @@ void test()
try
{
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
char mutable_char_buffer[128] = "";
const char const_char_buffer[128] = "";
socket_base::message_flags in_flags = 0;
@@ -75,12 +76,13 @@ void test()
int native_socket1 = ::socket(AF_UNIX, SOCK_STREAM, 0);
sp::socket socket4(ioc, sp(), native_socket1);
// basic_io_object functions.
sp::socket socket5(ioc_ex);
sp::socket socket6(ioc_ex, sp());
sp::socket socket7(ioc_ex, sp::endpoint(""));
int native_socket2 = ::socket(AF_UNIX, SOCK_STREAM, 0);
sp::socket socket8(ioc_ex, sp(), native_socket2);
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
#endif // !defined(ASIO_NO_DEPRECATED)
// basic_io_object functions.
sp::socket::executor_type ex = socket1.get_executor();
(void)ex;
@@ -93,10 +95,10 @@ void test()
socket1.open(sp());
socket1.open(sp(), ec);
int native_socket2 = ::socket(AF_UNIX, SOCK_STREAM, 0);
socket1.assign(sp(), native_socket2);
int native_socket3 = ::socket(AF_UNIX, SOCK_STREAM, 0);
socket1.assign(sp(), native_socket3, ec);
socket1.assign(sp(), native_socket3);
int native_socket4 = ::socket(AF_UNIX, SOCK_STREAM, 0);
socket1.assign(sp(), native_socket4, ec);
bool is_open = socket1.is_open();
(void)is_open;
@@ -104,8 +106,8 @@ void test()
socket1.close();
socket1.close(ec);
sp::socket::native_handle_type native_socket4 = socket1.native_handle();
(void)native_socket4;
sp::socket::native_handle_type native_socket5 = socket1.native_handle();
(void)native_socket5;
socket1.cancel();
socket1.cancel(ec);
@@ -138,10 +140,14 @@ void test()
socket1.io_control(io_control_command, ec);
sp::endpoint endpoint1 = socket1.local_endpoint();
(void)endpoint1;
sp::endpoint endpoint2 = socket1.local_endpoint(ec);
(void)endpoint2;
sp::endpoint endpoint3 = socket1.remote_endpoint();
(void)endpoint3;
sp::endpoint endpoint4 = socket1.remote_endpoint(ec);
(void)endpoint4;
socket1.shutdown(socket_base::shutdown_both);
socket1.shutdown(socket_base::shutdown_both, ec);

View File

@@ -2,7 +2,7 @@
// packaged_task.cpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// placeholders.cpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -12,4 +12,3 @@ basic_stream_descriptor
descriptor
descriptor_base
stream_descriptor
stream_descriptor_service

View File

@@ -2,7 +2,7 @@
// basic_descriptor.cpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// basic_stream_descriptor.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// descriptor.cpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// descriptor_base.cpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -2,7 +2,7 @@
// stream_descriptor.cpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -51,6 +51,7 @@ void test()
try
{
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
char mutable_char_buffer[128] = "";
const char const_char_buffer[128] = "";
posix::descriptor_base::bytes_readable io_control_command;
@@ -60,11 +61,13 @@ void test()
// basic_stream_descriptor constructors.
posix::stream_descriptor descriptor1(ioc);
posix::stream_descriptor descriptor2(ioc_ex);
int native_descriptor1 = -1;
posix::stream_descriptor descriptor2(ioc, native_descriptor1);
posix::stream_descriptor descriptor3(ioc, native_descriptor1);
posix::stream_descriptor descriptor4(ioc_ex, native_descriptor1);
#if defined(ASIO_HAS_MOVE)
posix::stream_descriptor descriptor3(std::move(descriptor2));
posix::stream_descriptor descriptor5(std::move(descriptor2));
#endif // defined(ASIO_HAS_MOVE)
// basic_stream_descriptor operators.
@@ -76,11 +79,6 @@ void test()
// basic_io_object functions.
#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = descriptor1.get_io_context();
(void)ioc_ref;
#endif // !defined(ASIO_NO_DEPRECATED)
posix::stream_descriptor::executor_type ex = descriptor1.get_executor();
(void)ex;
@@ -90,9 +88,9 @@ void test()
= descriptor1.lowest_layer();
(void)lowest_layer;
const posix::stream_descriptor& descriptor4 = descriptor1;
const posix::stream_descriptor& descriptor6 = descriptor1;
const posix::stream_descriptor::lowest_layer_type& lowest_layer2
= descriptor4.lowest_layer();
= descriptor6.lowest_layer();
(void)lowest_layer2;
int native_descriptor2 = -1;

View File

@@ -1,25 +0,0 @@
//
// stream_descriptor_service.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Disable autolinking for unit tests.
#if !defined(BOOST_ALL_NO_LIB)
#define BOOST_ALL_NO_LIB 1
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/posix/stream_descriptor_service.hpp"
#include "../unit_test.hpp"
ASIO_TEST_SUITE
(
"posix/stream_descriptor_service",
ASIO_TEST_CASE(null_test)
)

View File

@@ -2,7 +2,7 @@
// post.cpp
// ~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Some files were not shown because too many files have changed in this diff Show More