Skip to content

Commit c0ff7cb

Browse files
q66fxdupont
authored andcommitted
Update asiolink for boost 1.87
1 parent 05707e6 commit c0ff7cb

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

src/lib/asiolink/io_address.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ IOAddress::Hash::operator()(const IOAddress &io_address) const {
3737
// because we'd like to throw our own exception on failure.
3838
IOAddress::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());
@@ -116,7 +116,7 @@ IOAddress::isV6Multicast() const {
116116
uint32_t
117117
IOAddress::toUint32() const {
118118
if (asio_address_.is_v4()) {
119-
return (asio_address_.to_v4().to_ulong());
119+
return (asio_address_.to_v4().to_uint());
120120
} else {
121121
isc_throw(BadValue, "Can't convert " << toText()
122122
<< " address to IPv4.");

src/lib/asiolink/io_service.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class IOServiceImpl {
3030
/// @brief The constructor.
3131
IOServiceImpl() :
3232
io_service_(),
33-
work_(new boost::asio::io_service::work(io_service_)) {
33+
work_(boost::asio::make_work_guard(io_service_)) {
3434
};
3535

3636
/// @brief The destructor.
@@ -92,7 +92,7 @@ class IOServiceImpl {
9292

9393
/// @brief Restarts the IOService in preparation for a subsequent @ref run() invocation.
9494
void restart() {
95-
io_service_.reset();
95+
io_service_.restart();
9696
}
9797

9898
/// @brief Removes IO service work object to let it finish running
@@ -115,12 +115,12 @@ class IOServiceImpl {
115115
///
116116
/// @param callback The callback to be run on the IO service.
117117
void post(const std::function<void ()>& callback) {
118-
io_service_.post(callback);
118+
boost::asio::post(io_service_, callback);
119119
}
120120

121121
private:
122122
boost::asio::io_service io_service_;
123-
boost::shared_ptr<boost::asio::io_service::work> work_;
123+
boost::asio::executor_work_guard<boost::asio::io_service::executor_type> work_;
124124
};
125125

126126
IOService::IOService() : io_impl_(new IOServiceImpl()) {

src/lib/asiolink/tcp_endpoint.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TCPEndpoint : public IOEndpoint {
4242
/// \param port The TCP port number of the endpoint.
4343
TCPEndpoint(const IOAddress& address, const unsigned short port) :
4444
asio_endpoint_placeholder_(
45-
new boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(address.toText()),
45+
new boost::asio::ip::tcp::endpoint(boost::asio::ip::make_address(address.toText()),
4646
port)),
4747
asio_endpoint_(*asio_endpoint_placeholder_)
4848
{}

src/lib/asiolink/udp_endpoint.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class UDPEndpoint : public IOEndpoint {
4242
/// \param port The UDP port number of the endpoint.
4343
UDPEndpoint(const IOAddress& address, const unsigned short port) :
4444
asio_endpoint_placeholder_(
45-
new boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(address.toText()),
45+
new boost::asio::ip::udp::endpoint(boost::asio::ip::make_address(address.toText()),
4646
port)),
4747
asio_endpoint_(*asio_endpoint_placeholder_)
4848
{}

src/lib/asiolink/unix_domain_socket.cc

+8-8
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class UnixDomainSocketImpl : public boost::enable_shared_from_this<UnixDomainSoc
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-
void doSend(const boost::asio::const_buffers_1& buffer,
86+
void doSend(const boost::asio::const_buffer& buffer,
8787
const UnixDomainSocket::Handler& handler);
8888

8989

@@ -103,7 +103,7 @@ class UnixDomainSocketImpl : public boost::enable_shared_from_this<UnixDomainSoc
103103
/// @param ec Error code returned as a result of sending the data.
104104
/// @param length Length of the data sent.
105105
void sendHandler(const UnixDomainSocket::Handler& remote_handler,
106-
const boost::asio::const_buffers_1& buffer,
106+
const boost::asio::const_buffer& buffer,
107107
const boost::system::error_code& ec,
108108
size_t length);
109109

@@ -127,7 +127,7 @@ class UnixDomainSocketImpl : public boost::enable_shared_from_this<UnixDomainSoc
127127
/// @param buffer A buffer into which the data should be received.
128128
/// @param handler User supplied callback invoked when data have been
129129
/// received on an error is signalled.
130-
void doReceive(const boost::asio::mutable_buffers_1& buffer,
130+
void doReceive(const boost::asio::mutable_buffer& buffer,
131131
const UnixDomainSocket::Handler& handler);
132132

133133
/// @brief Local handler invoked as a result of asynchronous receive.
@@ -146,7 +146,7 @@ class UnixDomainSocketImpl : public boost::enable_shared_from_this<UnixDomainSoc
146146
/// @param ec Error code returned as a result of asynchronous receive.
147147
/// @param length Size of the received data.
148148
void receiveHandler(const UnixDomainSocket::Handler& remote_handler,
149-
const boost::asio::mutable_buffers_1& buffer,
149+
const boost::asio::mutable_buffer& buffer,
150150
const boost::system::error_code& ec,
151151
size_t length);
152152

@@ -197,7 +197,7 @@ UnixDomainSocketImpl::asyncSend(const void* data, const size_t length,
197197
}
198198

199199
void
200-
UnixDomainSocketImpl::doSend(const boost::asio::const_buffers_1& buffer,
200+
UnixDomainSocketImpl::doSend(const boost::asio::const_buffer& buffer,
201201
const UnixDomainSocket::Handler& handler) {
202202
auto local_handler = std::bind(&UnixDomainSocketImpl::sendHandler,
203203
shared_from_this(),
@@ -207,7 +207,7 @@ UnixDomainSocketImpl::doSend(const boost::asio::const_buffers_1& buffer,
207207

208208
void
209209
UnixDomainSocketImpl::sendHandler(const UnixDomainSocket::Handler& remote_handler,
210-
const boost::asio::const_buffers_1& buffer,
210+
const boost::asio::const_buffer& buffer,
211211
const boost::system::error_code& ec,
212212
size_t length) {
213213
// The asynchronous send may return EWOULDBLOCK or EAGAIN on some
@@ -230,7 +230,7 @@ UnixDomainSocketImpl::asyncReceive(void* data, const size_t length,
230230
}
231231

232232
void
233-
UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffers_1& buffer,
233+
UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffer& buffer,
234234
const UnixDomainSocket::Handler& handler) {
235235
auto local_handler = std::bind(&UnixDomainSocketImpl::receiveHandler,
236236
shared_from_this(),
@@ -240,7 +240,7 @@ UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffers_1& buffer,
240240

241241
void
242242
UnixDomainSocketImpl::receiveHandler(const UnixDomainSocket::Handler& remote_handler,
243-
const boost::asio::mutable_buffers_1& buffer,
243+
const boost::asio::mutable_buffer& buffer,
244244
const boost::system::error_code& ec,
245245
size_t length) {
246246
// The asynchronous receive may return EWOULDBLOCK or EAGAIN on some

src/lib/dhcp/iface_mgr.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ IfaceMgr::getLocalAddress(const IOAddress& remote_addr, const uint16_t port) {
10341034
}
10351035

10361036
// Create socket that will be used to connect to remote endpoint.
1037-
boost::asio::io_service io_service;
1037+
boost::asio::io_context io_service;
10381038
boost::asio::ip::udp::socket sock(io_service);
10391039

10401040
boost::system::error_code err_code;

0 commit comments

Comments
 (0)