From 6300b3c937f91042594cf0944a8ec358d5bed809 Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 15 Dec 2024 03:04:53 +0100 Subject: [PATCH] Update asiolink for boost 1.87 --- src/lib/asiolink/io_address.cc | 4 ++-- src/lib/asiolink/io_service.cc | 8 ++++---- src/lib/asiolink/tcp_endpoint.h | 2 +- src/lib/asiolink/udp_endpoint.h | 2 +- src/lib/asiolink/unix_domain_socket.cc | 16 ++++++++-------- src/lib/dhcp/iface_mgr.cc | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/lib/asiolink/io_address.cc b/src/lib/asiolink/io_address.cc index 43459bfe5a..06b7d3d990 100644 --- a/src/lib/asiolink/io_address.cc +++ b/src/lib/asiolink/io_address.cc @@ -37,7 +37,7 @@ IOAddress::Hash::operator()(const IOAddress &io_address) const { // because we'd like to throw our own exception on failure. IOAddress::IOAddress(const std::string& address_str) { boost::system::error_code err; - asio_address_ = ip::address::from_string(address_str, err); + asio_address_ = ip::make_address(address_str, err); if (err) { isc_throw(IOError, "Failed to convert string to address '" << address_str << "': " << err.message()); @@ -116,7 +116,7 @@ IOAddress::isV6Multicast() const { uint32_t IOAddress::toUint32() const { if (asio_address_.is_v4()) { - return (asio_address_.to_v4().to_ulong()); + return (asio_address_.to_v4().to_uint()); } else { isc_throw(BadValue, "Can't convert " << toText() << " address to IPv4."); diff --git a/src/lib/asiolink/io_service.cc b/src/lib/asiolink/io_service.cc index 411de64191..cc28d24c19 100644 --- a/src/lib/asiolink/io_service.cc +++ b/src/lib/asiolink/io_service.cc @@ -30,7 +30,7 @@ class IOServiceImpl { /// @brief The constructor. IOServiceImpl() : io_service_(), - work_(new boost::asio::io_service::work(io_service_)) { + work_(boost::asio::make_work_guard(io_service_)) { }; /// @brief The destructor. @@ -92,7 +92,7 @@ class IOServiceImpl { /// @brief Restarts the IOService in preparation for a subsequent @ref run() invocation. void restart() { - io_service_.reset(); + io_service_.restart(); } /// @brief Removes IO service work object to let it finish running @@ -115,12 +115,12 @@ class IOServiceImpl { /// /// @param callback The callback to be run on the IO service. void post(const std::function& callback) { - io_service_.post(callback); + boost::asio::post(io_service_, callback); } private: boost::asio::io_service io_service_; - boost::shared_ptr work_; + boost::asio::executor_work_guard work_; }; IOService::IOService() : io_impl_(new IOServiceImpl()) { diff --git a/src/lib/asiolink/tcp_endpoint.h b/src/lib/asiolink/tcp_endpoint.h index 8ebd57551d..7c8cb35535 100644 --- a/src/lib/asiolink/tcp_endpoint.h +++ b/src/lib/asiolink/tcp_endpoint.h @@ -42,7 +42,7 @@ class TCPEndpoint : public IOEndpoint { /// \param port The TCP port number of the endpoint. TCPEndpoint(const IOAddress& address, const unsigned short port) : asio_endpoint_placeholder_( - new boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(address.toText()), + new boost::asio::ip::tcp::endpoint(boost::asio::ip::make_address(address.toText()), port)), asio_endpoint_(*asio_endpoint_placeholder_) {} diff --git a/src/lib/asiolink/udp_endpoint.h b/src/lib/asiolink/udp_endpoint.h index f960bf3ce9..2a3da9f046 100644 --- a/src/lib/asiolink/udp_endpoint.h +++ b/src/lib/asiolink/udp_endpoint.h @@ -42,7 +42,7 @@ class UDPEndpoint : public IOEndpoint { /// \param port The UDP port number of the endpoint. UDPEndpoint(const IOAddress& address, const unsigned short port) : asio_endpoint_placeholder_( - new boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(address.toText()), + new boost::asio::ip::udp::endpoint(boost::asio::ip::make_address(address.toText()), port)), asio_endpoint_(*asio_endpoint_placeholder_) {} diff --git a/src/lib/asiolink/unix_domain_socket.cc b/src/lib/asiolink/unix_domain_socket.cc index f43e1c9e9b..43ff3c8f24 100644 --- a/src/lib/asiolink/unix_domain_socket.cc +++ b/src/lib/asiolink/unix_domain_socket.cc @@ -83,7 +83,7 @@ class UnixDomainSocketImpl : public boost::enable_shared_from_this