Ticket #21043: kea-2.6.1-fix_boost_1_87-1.patch

File kea-2.6.1-fix_boost_1_87-1.patch, 13.3 KB (added by thomas, 8 weeks ago)

I've adopted the Gentoo patch to apply on kea-2.6.1. Hopefully it fixes stuff and does not damage something else...

  • TabularUnified src/lib/asiolink/io_address.cc

    diff -Naur kea-2.6.1.orig/src/lib/asiolink/io_address.cc kea-2.6.1/src/lib/asiolink/io_address.cc
    old new  
    3737// because we'd like to throw our own exception on failure.
    3838IOAddress::IOAddress(const std::string& address_str) {
    3939    boost::system::error_code err;
    40     asio_address_ = ip::address::from_string(address_str, err);
     40    asio_address_ = ip::make_address(address_str, err);
    4141    if (err) {
    4242        isc_throw(IOError, "Failed to convert string to address '"
    4343                  << address_str << "': " << err.message());
     
    116116uint32_t
    117117IOAddress::toUint32() const {
    118118    if (asio_address_.is_v4()) {
     119#if BOOST_VERSION < 108000       
    119120        return (asio_address_.to_v4().to_ulong());
     121#else
     122        return (asio_address_.to_v4().to_uint());
     123#endif
     124
    120125    } else {
    121126        isc_throw(BadValue, "Can't convert " << toText()
    122127                  << " address to IPv4.");
  • TabularUnified src/lib/asiolink/io_service.cc

    diff -Naur kea-2.6.1.orig/src/lib/asiolink/io_service.cc kea-2.6.1/src/lib/asiolink/io_service.cc
    old new  
    2929public:
    3030    /// @brief The constructor.
    3131    IOServiceImpl() :
    32         io_service_(),
    33         work_(new boost::asio::io_service::work(io_service_)) {
     32        io_context_() {
    3433    };
    3534
    3635    /// @brief The destructor.
     
    4241    /// This method does not return control to the caller until
    4342    /// the @ref stop() or @ref stopWork() method is called via some handler.
    4443    void run() {
    45         io_service_.run();
     44        io_context_.run();
    4645    };
    4746
    4847    /// @brief Run the underlying event loop for a single event.
     
    5352    ///
    5453    /// @return The number of handlers that were executed.
    5554    size_t runOne() {
    56         return (static_cast<size_t>(io_service_.run_one()));
     55        return (static_cast<size_t>(io_context_.run_one()));
    5756    };
    5857
    5958    /// @brief Run the underlying event loop for a ready events.
     
    6362    ///
    6463    /// @return The number of handlers that were executed.
    6564    size_t poll() {
    66         return (static_cast<size_t>(io_service_.poll()));
     65        return (static_cast<size_t>(io_context_.poll()));
    6766    };
    6867
    6968    /// @brief Run the underlying event loop for a ready events.
     
    7372    ///
    7473    /// @return The number of handlers that were executed.
    7574    size_t pollOne() {
    76         return (static_cast<size_t>(io_service_.poll_one()));
     75        return (static_cast<size_t>(io_context_.poll_one()));
    7776    };
    7877
    7978    /// @brief Stop the underlying event loop.
    8079    ///
    8180    /// This will return the control to the caller of the @ref run() method.
    8281    void stop() {
    83         io_service_.stop();
     82        io_context_.stop();
    8483    }
    8584
    8685    /// @brief Indicates if the IOService has been stopped.
    8786    ///
    8887    /// @return true if the IOService has been stopped, false otherwise.
    8988    bool stopped() const {
    90         return (io_service_.stopped());
     89        return (io_context_.stopped());
    9190    }
    9291
    9392    /// @brief Restarts the IOService in preparation for a subsequent @ref run() invocation.
    9493    void restart() {
    95         io_service_.reset();
     94        io_context_.restart();
    9695    }
    9796
    9897    /// @brief Removes IO service work object to let it finish running
    9998    /// when all handlers have been invoked.
    10099    void stopWork() {
    101         work_.reset();
     100        io_context_.stop();
    102101    }
    103102
    104103    /// @brief Return the native @c io_service object used in this wrapper.
     
    107106    /// that share the same @c io_service with the authoritative server.
    108107    /// It will eventually be removed once the wrapper interface is
    109108    /// generalized.
    110     boost::asio::io_service& getInternalIOService() {
    111         return (io_service_);
     109    boost::asio::io_context& getInternalIOService() {
     110        return (io_context_);
    112111    }
    113112
    114113    /// @brief Post a callback on the IO service.
    115114    ///
    116115    /// @param callback The callback to be run on the IO service.
    117116    void post(const std::function<void ()>& callback) {
    118         io_service_.post(callback);
     117        boost::asio::post(io_context_, callback);
    119118    }
    120119
    121120private:
    122     boost::asio::io_service io_service_;
    123     boost::shared_ptr<boost::asio::io_service::work> work_;
     121    boost::asio::io_context io_context_;
    124122};
    125123
  • TabularUnified src/lib/asiolink/io_service.h

    diff -Naur kea-2.6.1.orig/src/lib/asiolink/io_service.h kea-2.6.1/src/lib/asiolink/io_service.h
    old new  
    107107    /// generalized.
    108108    ///
    109109    /// @return The internal io_service object.
    110     boost::asio::io_service& getInternalIOService();
     110    boost::asio::io_context& getInternalIOService();
    111111
    112112    /// @brief Post a callback to the end of the queue.
    113113    ///
  • TabularUnified src/lib/asiolink/tcp_endpoint.h

    diff -Naur kea-2.6.1.orig/src/lib/asiolink/tcp_endpoint.h kea-2.6.1/src/lib/asiolink/tcp_endpoint.h
    old new  
    4242    /// \param port The TCP port number of the endpoint.
    4343    TCPEndpoint(const IOAddress& address, const unsigned short port) :
    4444        asio_endpoint_placeholder_(
     45#if BOOST_VERSION < 108000
    4546            new boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(address.toText()),
     47#else
     48            new boost::asio::ip::tcp::endpoint(boost::asio::ip::make_address(address.toText()),
     49#endif
     50
    4651                              port)),
    4752        asio_endpoint_(*asio_endpoint_placeholder_)
    4853    {}
  • TabularUnified src/lib/asiolink/udp_endpoint.h

    diff -Naur kea-2.6.1.orig/src/lib/asiolink/udp_endpoint.h kea-2.6.1/src/lib/asiolink/udp_endpoint.h
    old new  
    4242    /// \param port The UDP port number of the endpoint.
    4343    UDPEndpoint(const IOAddress& address, const unsigned short port) :
    4444        asio_endpoint_placeholder_(
     45#if BOOST_VERSION < 108000
    4546            new boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(address.toText()),
     47#else               
     48            new boost::asio::ip::udp::endpoint(boost::asio::ip::make_address(address.toText()),
     49#endif               
    4650                              port)),
    4751        asio_endpoint_(*asio_endpoint_placeholder_)
    4852    {}
  • TabularUnified src/lib/asiolink/unix_domain_socket.cc

    diff -Naur kea-2.6.1.orig/src/lib/asiolink/unix_domain_socket.cc kea-2.6.1/src/lib/asiolink/unix_domain_socket.cc
    old new  
    8383    /// @param buffer Buffers holding the data to be sent.
    8484    /// @param handler User supplied callback to be invoked when data have
    8585    /// been sent or sending error is signalled.
     86#if BOOST_VERSION < 108000
    8687    void doSend(const boost::asio::const_buffers_1& buffer,
    8788                const UnixDomainSocket::Handler& handler);
    88 
     89#else
     90    void doSend(const boost::asio::const_buffer& buffer,
     91                const UnixDomainSocket::Handler& handler);
     92#endif
    8993
    9094    /// @brief Local handler invoked as a result of asynchronous send.
    9195    ///
     
    102106    /// @param buffer Buffers holding the data to be sent.
    103107    /// @param ec Error code returned as a result of sending the data.
    104108    /// @param length Length of the data sent.
     109#if BOOST_VERSION < 108000
    105110    void sendHandler(const UnixDomainSocket::Handler& remote_handler,
    106111                     const boost::asio::const_buffers_1& buffer,
    107112                     const boost::system::error_code& ec,
    108113                     size_t length);
     114#else
     115    void sendHandler(const UnixDomainSocket::Handler& remote_handler,
     116                     const boost::asio::const_buffer& buffer,
     117                     const boost::system::error_code& ec,
     118                     size_t length);
     119#endif
    109120
    110121    /// @brief Asynchronously receive data over the socket.
    111122    ///
     
    127138    /// @param buffer A buffer into which the data should be received.
    128139    /// @param handler User supplied callback invoked when data have been
    129140    /// received on an error is signalled.
     141#if BOOST_VERSION < 108000
    130142    void doReceive(const boost::asio::mutable_buffers_1& buffer,
    131143                   const UnixDomainSocket::Handler& handler);
    132 
     144#else
     145    void doReceive(const boost::asio::mutable_buffer& buffer,
     146                   const UnixDomainSocket::Handler& handler);
     147#endif
    133148    /// @brief Local handler invoked as a result of asynchronous receive.
    134149    ///
    135150    /// This handler is invoked as a result of asynchronous receive. It is a
     
    145160    /// @param buffer Buffer into which the data are received.
    146161    /// @param ec Error code returned as a result of asynchronous receive.
    147162    /// @param length Size of the received data.
     163#if BOOST_VERSION < 108000
    148164    void receiveHandler(const UnixDomainSocket::Handler& remote_handler,
    149165                        const boost::asio::mutable_buffers_1& buffer,
    150166                        const boost::system::error_code& ec,
    151167                        size_t length);
    152 
     168#else
     169    void receiveHandler(const UnixDomainSocket::Handler& remote_handler,
     170                        const boost::asio::mutable_buffer& buffer,
     171                        const boost::system::error_code& ec,
     172                        size_t length);
     173#endif
    153174    /// @brief Disables read and write operations on the socket.
    154175    void shutdown();
    155176
     
    196217    doSend(boost::asio::buffer(data, length), handler);
    197218}
    198219
     220#if BOOST_VERSION < 108000
    199221void
    200222UnixDomainSocketImpl::doSend(const boost::asio::const_buffers_1& buffer,
    201223                             const UnixDomainSocket::Handler& handler) {
     224#else
     225void
     226UnixDomainSocketImpl::doSend(const boost::asio::const_buffer& buffer,
     227                             const UnixDomainSocket::Handler& handler) {
     228#endif
    202229    auto local_handler = std::bind(&UnixDomainSocketImpl::sendHandler,
    203230                                   shared_from_this(),
    204231                                   handler, buffer, ph::_1, ph::_2);
    205232    socket_.async_send(buffer, local_handler);
    206233}
    207234
     235#if BOOST_VERSION < 108000
    208236void
    209237UnixDomainSocketImpl::sendHandler(const UnixDomainSocket::Handler& remote_handler,
    210238                                  const boost::asio::const_buffers_1& buffer,
    211239                                  const boost::system::error_code& ec,
    212240                                  size_t length) {
     241#else
     242void
     243UnixDomainSocketImpl::sendHandler(const UnixDomainSocket::Handler& remote_handler,
     244                                  const boost::asio::const_buffer& buffer,
     245                                  const boost::system::error_code& ec,
     246                                  size_t length) {
     247#endif
    213248    // The asynchronous send may return EWOULDBLOCK or EAGAIN on some
    214249    // operating systems. In this case, we simply retry hoping that it
    215250    // will succeed next time. The user's callback never sees these
     
    229264    doReceive(boost::asio::buffer(data, length), handler);
    230265}
    231266
     267#if BOOST_VERSION < 108000
    232268void
    233269UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffers_1& buffer,
    234270                                const UnixDomainSocket::Handler& handler) {
     271#else
     272void
     273UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffer& buffer,
     274                                const UnixDomainSocket::Handler& handler) {
     275#endif
    235276    auto local_handler = std::bind(&UnixDomainSocketImpl::receiveHandler,
    236277                                   shared_from_this(),
    237278                                   handler, buffer, ph::_1, ph::_2);
    238279    socket_.async_receive(buffer, 0, local_handler);
    239280}
    240281
     282#if BOOST_VERSION < 108000
    241283void
    242284UnixDomainSocketImpl::receiveHandler(const UnixDomainSocket::Handler& remote_handler,
    243285                                     const boost::asio::mutable_buffers_1& buffer,
    244286                                     const boost::system::error_code& ec,
    245287                                     size_t length) {
     288#else
     289void
     290UnixDomainSocketImpl::receiveHandler(const UnixDomainSocket::Handler& remote_handler,
     291                                     const boost::asio::mutable_buffer& buffer,
     292                                     const boost::system::error_code& ec,
     293                                     size_t length) {
     294#endif
     295
    246296    // The asynchronous receive may return EWOULDBLOCK or EAGAIN on some
    247297    // operating systems. In this case, we simply retry hoping that it
    248298    // will succeed next time. The user's callback never sees these
  • TabularUnified src/lib/dhcp/iface_mgr.cc

    diff -Naur kea-2.6.1.orig/src/lib/dhcp/iface_mgr.cc kea-2.6.1/src/lib/dhcp/iface_mgr.cc
    old new  
    10341034    }
    10351035
    10361036    // Create socket that will be used to connect to remote endpoint.
     1037#if BOOST_VERSION < 108000
    10371038    boost::asio::io_service io_service;
     1039#else
     1040    boost::asio::io_context io_service;
     1041#endif
    10381042    boost::asio::ip::udp::socket sock(io_service);
    10391043
     1044
    10401045    boost::system::error_code err_code;
    10411046    // If remote address is broadcast address we have to
    10421047    // allow this on the socket.