Skip to content

Commit

Permalink
Replace deprecated asio::io_service and asio::ip::tcp::resolver::query
Browse files Browse the repository at this point in the history
Boost APIs
  • Loading branch information
offa committed Jan 7, 2025
1 parent 6a16428 commit 3f2acda
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/TCP.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ namespace influxdb::transports
: mSocket(mIoService)
{
ba::ip::tcp::resolver resolver(mIoService);
ba::ip::tcp::resolver::query query(hostname, std::to_string(port));
ba::ip::tcp::resolver::iterator resolverIterator = resolver.resolve(query);
ba::ip::tcp::resolver::iterator end;
mEndpoint = *resolverIterator;
mEndpoint = *(resolver.resolve(ba::ip::tcp::v4(), hostname, std::to_string(port), ba::ip::resolver_query_base::passive));
mSocket.open(mEndpoint.protocol());
reconnect();
}
Expand Down
2 changes: 1 addition & 1 deletion src/TCP.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace influxdb::transports

private:
/// Boost Asio I/O functionality
boost::asio::io_service mIoService;
boost::asio::io_context mIoService;

/// TCP socket
boost::asio::ip::tcp::socket mSocket;
Expand Down
2 changes: 1 addition & 1 deletion src/UDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace influxdb::transports

private:
/// Boost Asio I/O functionality
boost::asio::io_service mIoService;
boost::asio::io_context mIoService;

/// UDP socket
boost::asio::ip::udp::socket mSocket;
Expand Down
2 changes: 1 addition & 1 deletion src/UnixSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace influxdb::transports

private:
/// Boost Asio I/O functionality
boost::asio::io_service mIoService;
boost::asio::io_context mIoService;
#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
/// Unix socket
boost::asio::local::datagram_protocol::socket mSocket;
Expand Down

0 comments on commit 3f2acda

Please sign in to comment.