]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/asio/example/cpp03/icmp/ping.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / asio / example / cpp03 / icmp / ping.cpp
index 7bc35b0514faca06d9a5916524712e08a6cec23b..4daf81948b9af7f7c3c55ecc4489e51b49c496cd 100644 (file)
@@ -2,7 +2,7 @@
 // ping.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)
@@ -24,12 +24,11 @@ namespace posix_time = boost::posix_time;
 class pinger
 {
 public:
-  pinger(boost::asio::io_service& io_service, const char* destination)
-    : resolver_(io_service), socket_(io_service, icmp::v4()),
-      timer_(io_service), sequence_number_(0), num_replies_(0)
+  pinger(boost::asio::io_context& io_context, const char* destination)
+    : resolver_(io_context), socket_(io_context, icmp::v4()),
+      timer_(io_context), sequence_number_(0), num_replies_(0)
   {
-    icmp::resolver::query query(icmp::v4(), destination, "");
-    destination_ = *resolver_.resolve(query);
+    destination_ = *resolver_.resolve(icmp::v4(), destination, "").begin();
 
     start_send();
     start_receive();
@@ -151,9 +150,9 @@ int main(int argc, char* argv[])
       return 1;
     }
 
-    boost::asio::io_service io_service;
-    pinger p(io_service, argv[1]);
-    io_service.run();
+    boost::asio::io_context io_context;
+    pinger p(io_context, argv[1]);
+    io_context.run();
   }
   catch (std::exception& e)
   {