Update deprecated features removed in Boost ASIO 1.87 (#153)

This commit is contained in:
Lee *!* Clagett
2025-02-22 12:49:57 -05:00
committed by Lee *!* Clagett
parent 29358f1323
commit b5d0844bbd
6 changed files with 32 additions and 21 deletions

View File

@@ -121,7 +121,7 @@ namespace lws { namespace rpc { namespace scanner
for (;;)
{
MINFO("Attempting connection to " << self_->server_address_);
self_->connect_timer_.expires_from_now(connect_timeout);
self_->connect_timer_.expires_after(connect_timeout);
self_->connect_timer_.async_wait(
boost::asio::bind_executor(self_->strand_, close{self_})
);
@@ -139,7 +139,7 @@ namespace lws { namespace rpc { namespace scanner
break;
MINFO("Retrying connection in " << std::chrono::seconds{reconnect_interval}.count() << " seconds");
self_->connect_timer_.expires_from_now(reconnect_interval);
self_->connect_timer_.expires_after(reconnect_interval);
BOOST_ASIO_CORO_YIELD self_->connect_timer_.async_wait(
boost::asio::bind_executor(self_->strand_, *this)
);

View File

@@ -203,7 +203,7 @@ namespace lws { namespace rpc { namespace scanner
return;
assert(self_->strand_.running_in_this_thread());
self_->check_timer_.expires_from_now(account_poll_interval);
self_->check_timer_.expires_after(account_poll_interval);
self_->check_timer_.async_wait(boost::asio::bind_executor(self_->strand_, *this));
std::size_t total_threads = self_->local_.size();
@@ -422,7 +422,7 @@ namespace lws { namespace rpc { namespace scanner
MDEBUG("Stopping rpc::scanner::server async operations");
boost::system::error_code error{};
check_timer_.cancel(error);
check_timer_.cancel();
acceptor_.cancel(error);
acceptor_.close(error);
@@ -454,7 +454,7 @@ namespace lws { namespace rpc { namespace scanner
}
}
return boost::asio::ip::tcp::endpoint{
boost::asio::ip::address::from_string(host), boost::lexical_cast<unsigned short>(port)
boost::asio::ip::make_address(host), boost::lexical_cast<unsigned short>(port)
};
}

View File

@@ -118,7 +118,7 @@ namespace lws { namespace rpc { namespace scanner
{
while (!self_->write_bufs_.empty())
{
self_->write_timeout_.expires_from_now(std::chrono::seconds{10});
self_->write_timeout_.expires_after(std::chrono::seconds{10});
self_->write_timeout_.async_wait(boost::asio::bind_executor(self_->strand_, timeout<T>{self_}));
BOOST_ASIO_CORO_YIELD boost::asio::async_write(
self_->sock_, self_->write_buffer(), boost::asio::bind_executor(self_->strand_, *this)
@@ -190,6 +190,17 @@ namespace lws { namespace rpc { namespace scanner
: self_(rhs.self_), msg_(rhs.msg_.clone())
{}
queue_slice& operator=(queue_slice&&) = default;
queue_slice& operator=(const queue_slice& rhs)
{
if (this != std::addressof(rhs))
{
self_ = rhs.self_;
msg_ = rhs.msg_.clone();
}
return *this;
}
void operator()()
{
if (!self_)