]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/asio/test/buffered_write_stream.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / asio / test / buffered_write_stream.cpp
index dd092b6cc71b7713fb2ed22d21d7916b9e23bd0d..f75a9f65c28ab36077d8a6ae7d9c3232493c504b 100644 (file)
@@ -2,7 +2,7 @@
 // buffered_write_stream.cpp
 // ~~~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// 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)
@@ -19,7 +19,7 @@
 #include <cstring>
 #include "archetypes/async_result.hpp"
 #include <boost/asio/buffer.hpp>
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
 #include <boost/asio/ip/tcp.hpp>
 #include <boost/system/system_error.hpp>
 #include "unit_test.hpp"
@@ -63,7 +63,7 @@ void test_compile()
 
   try
   {
-    io_service ios;
+    io_context ioc;
     char mutable_char_buffer[128] = "";
     const char const_char_buffer[128] = "";
     array<boost::asio::mutable_buffer, 2> mutable_buffers = {{
@@ -75,11 +75,19 @@ void test_compile()
     archetypes::lazy_handler lazy;
     boost::system::error_code ec;
 
-    stream_type stream1(ios);
-    stream_type stream2(ios, 1024);
+    stream_type stream1(ioc);
+    stream_type stream2(ioc, 1024);
 
-    io_service& ios_ref = stream1.get_io_service();
-    (void)ios_ref;
+    stream_type::executor_type ex = stream1.get_executor();
+    (void)ex;
+
+#if !defined(BOOST_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(BOOST_ASIO_NO_DEPRECATED)
 
     stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer();
     (void)lowest_layer;
@@ -144,17 +152,17 @@ void test_sync_operations()
 {
   using namespace std; // For memcmp.
 
-  boost::asio::io_service io_service;
+  boost::asio::io_context io_context;
 
-  boost::asio::ip::tcp::acceptor acceptor(io_service,
+  boost::asio::ip::tcp::acceptor acceptor(io_context,
       boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 0));
   boost::asio::ip::tcp::endpoint server_endpoint = acceptor.local_endpoint();
   server_endpoint.address(boost::asio::ip::address_v4::loopback());
 
-  stream_type client_socket(io_service);
+  stream_type client_socket(io_context);
   client_socket.lowest_layer().connect(server_endpoint);
 
-  stream_type server_socket(io_service);
+  stream_type server_socket(io_context);
   acceptor.accept(server_socket.lowest_layer());
 
   const char write_data[]
@@ -262,20 +270,20 @@ void test_async_operations()
   using std::placeholders::_2;
 #endif // defined(BOOST_ASIO_HAS_BOOST_BIND)
 
-  boost::asio::io_service io_service;
+  boost::asio::io_context io_context;
 
-  boost::asio::ip::tcp::acceptor acceptor(io_service,
+  boost::asio::ip::tcp::acceptor acceptor(io_context,
       boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 0));
   boost::asio::ip::tcp::endpoint server_endpoint = acceptor.local_endpoint();
   server_endpoint.address(boost::asio::ip::address_v4::loopback());
 
-  stream_type client_socket(io_service);
+  stream_type client_socket(io_context);
   client_socket.lowest_layer().connect(server_endpoint);
 
-  stream_type server_socket(io_service);
+  stream_type server_socket(io_context);
   acceptor.async_accept(server_socket.lowest_layer(), &handle_accept);
-  io_service.run();
-  io_service.reset();
+  io_context.run();
+  io_context.restart();
 
   const char write_data[]
     = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -287,12 +295,12 @@ void test_async_operations()
     client_socket.async_write_some(
         boost::asio::buffer(write_buf + bytes_written),
         bindns::bind(handle_write, _1, _2, &bytes_written));
-    io_service.run();
-    io_service.reset();
+    io_context.run();
+    io_context.restart();
     client_socket.async_flush(
         bindns::bind(handle_flush, _1));
-    io_service.run();
-    io_service.reset();
+    io_context.run();
+    io_context.restart();
   }
 
   char read_data[sizeof(write_data)];
@@ -304,8 +312,8 @@ void test_async_operations()
     server_socket.async_read_some(
         boost::asio::buffer(read_buf + bytes_read),
         bindns::bind(handle_read, _1, _2, &bytes_read));
-    io_service.run();
-    io_service.reset();
+    io_context.run();
+    io_context.restart();
   }
 
   BOOST_ASIO_CHECK(bytes_written == sizeof(write_data));
@@ -318,12 +326,12 @@ void test_async_operations()
     server_socket.async_write_some(
         boost::asio::buffer(write_buf + bytes_written),
         bindns::bind(handle_write, _1, _2, &bytes_written));
-    io_service.run();
-    io_service.reset();
+    io_context.run();
+    io_context.restart();
     server_socket.async_flush(
         bindns::bind(handle_flush, _1));
-    io_service.run();
-    io_service.reset();
+    io_context.run();
+    io_context.restart();
   }
 
   bytes_read = 0;
@@ -332,8 +340,8 @@ void test_async_operations()
     client_socket.async_read_some(
         boost::asio::buffer(read_buf + bytes_read),
         bindns::bind(handle_read, _1, _2, &bytes_read));
-    io_service.run();
-    io_service.reset();
+    io_context.run();
+    io_context.restart();
   }
 
   BOOST_ASIO_CHECK(bytes_written == sizeof(write_data));