--- a/src/cpp/flann/mpi/client.h +++ b/src/cpp/flann/mpi/client.h @@ -45,17 +45,16 @@ class Client public: Client(const std::string& host, const std::string& service) { - tcp::resolver resolver(io_service_); - tcp::resolver::query query(tcp::v4(), host, service); - iterator_ = resolver.resolve(query); + tcp::resolver resolver(io_context_); + results_ = resolver.resolve(host, service); } template void knnSearch(const flann::Matrix& queries, flann::Matrix& indices, flann::Matrix& dists, int knn, const SearchParams& params) { - tcp::socket sock(io_service_); - sock.connect(*iterator_); + tcp::socket sock(io_context_); + boost::asio::connect(sock, results_); Request req; req.nn = knn; @@ -78,8 +77,8 @@ public: private: - boost::asio::io_service io_service_; - tcp::resolver::iterator iterator_; + boost::asio::io_context io_context_; + tcp::resolver::results_type results_; }; --- a/src/cpp/flann/mpi/server.h +++ b/src/cpp/flann/mpi/server.h @@ -119,18 +119,18 @@ public: void run() { boost::mpi::communicator world; - boost::shared_ptr io_service; + boost::shared_ptr io_context; boost::shared_ptr acceptor; if (world.rank()==0) { - io_service.reset(new boost::asio::io_service()); - acceptor.reset(new tcp::acceptor(*io_service, tcp::endpoint(tcp::v4(), port_))); + io_context.reset(new boost::asio::io_context()); + acceptor.reset(new tcp::acceptor(*io_context, tcp::endpoint(tcp::v4(), port_))); std::cout << "Start listening for queries...\n"; } for (;;) { socket_ptr sock; if (world.rank()==0) { - sock.reset(new tcp::socket(*io_service)); + sock.reset(new tcp::socket(*io_context)); acceptor->accept(*sock); std::cout << "Accepted connection\n"; }