]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/asio/example/cpp11/echo/blocking_tcp_echo_server.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / asio / example / cpp11 / echo / blocking_tcp_echo_server.cpp
index 61fd9271ce8c6a25fdd10faf57aee853ac54466d..44c69c0daec9c5d1bfc48f9d29a256ef1cac6977 100644 (file)
@@ -2,7 +2,7 @@
 // blocking_tcp_echo_server.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)
@@ -42,14 +42,12 @@ void session(tcp::socket sock)
   }
 }
 
-void server(boost::asio::io_service& io_service, unsigned short port)
+void server(boost::asio::io_context& io_context, unsigned short port)
 {
-  tcp::acceptor a(io_service, tcp::endpoint(tcp::v4(), port));
+  tcp::acceptor a(io_context, tcp::endpoint(tcp::v4(), port));
   for (;;)
   {
-    tcp::socket sock(io_service);
-    a.accept(sock);
-    std::thread(session, std::move(sock)).detach();
+    std::thread(session, a.accept()).detach();
   }
 }
 
@@ -63,9 +61,9 @@ int main(int argc, char* argv[])
       return 1;
     }
 
-    boost::asio::io_service io_service;
+    boost::asio::io_context io_context;
 
-    server(io_service, std::atoi(argv[1]));
+    server(io_context, std::atoi(argv[1]));
   }
   catch (std::exception& e)
   {