mirror of
https://github.com/vtnerd/monero-lws.git
synced 2025-01-03 17:29:25 +00:00
Update deprecated features removed in Boost ASIO 1.87
This commit is contained in:
parent
b659200a2b
commit
8226381a21
6 changed files with 32 additions and 21 deletions
1
.github/workflows/build-ubuntu.yml
vendored
1
.github/workflows/build-ubuntu.yml
vendored
|
@ -19,6 +19,7 @@ jobs:
|
||||||
build-tests:
|
build-tests:
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, macos-latest, macos-14, macos-13]
|
os: [ubuntu-latest, ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, macos-latest, macos-14, macos-13]
|
||||||
rmq: [WITH_RMQ=ON, WITH_RMQ=OFF]
|
rmq: [WITH_RMQ=ON, WITH_RMQ=OFF]
|
||||||
|
|
|
@ -377,7 +377,7 @@ namespace lws
|
||||||
{
|
{
|
||||||
std::shared_ptr<frame> self_;
|
std::shared_ptr<frame> self_;
|
||||||
|
|
||||||
void operator()(boost::system::error_code error) const
|
void operator()(const boost::system::error_code error) const
|
||||||
{
|
{
|
||||||
if (!self_ || error == boost::asio::error::operation_aborted)
|
if (!self_ || error == boost::asio::error::operation_aborted)
|
||||||
return;
|
return;
|
||||||
|
@ -385,7 +385,7 @@ namespace lws
|
||||||
assert(self_->strand.running_in_this_thread());
|
assert(self_->strand.running_in_this_thread());
|
||||||
MWARNING("Timeout on /daemon_status ZMQ call");
|
MWARNING("Timeout on /daemon_status ZMQ call");
|
||||||
self_->client.close = true;
|
self_->client.close = true;
|
||||||
self_->client.asock->cancel(error);
|
self_->client.asock->cancel();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ namespace lws
|
||||||
self.client, self.in, boost::asio::bind_executor(self.strand, std::move(*this))
|
self.client, self.in, boost::asio::bind_executor(self.strand, std::move(*this))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!self.timer.cancel(error))
|
if (!self.timer.cancel())
|
||||||
return send_response(boost::asio::error::operation_aborted, json_response(async_response{}));
|
return send_response(boost::asio::error::operation_aborted, json_response(async_response{}));
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -838,7 +838,7 @@ namespace lws
|
||||||
net::zmq::async_read(self_->client, in, yield[error]);
|
net::zmq::async_read(self_->client, in, yield[error]);
|
||||||
if (error)
|
if (error)
|
||||||
return send_response(error, async_ready());
|
return send_response(error, async_ready());
|
||||||
if (!self_->timer.cancel(error))
|
if (!self_->timer.cancel())
|
||||||
return send_response(boost::asio::error::operation_aborted, async_ready());
|
return send_response(boost::asio::error::operation_aborted, async_ready());
|
||||||
|
|
||||||
histogram_rpc::Response histogram_resp{};
|
histogram_rpc::Response histogram_resp{};
|
||||||
|
@ -884,7 +884,7 @@ namespace lws
|
||||||
net::zmq::async_read(self_->client, in, yield[error]);
|
net::zmq::async_read(self_->client, in, yield[error]);
|
||||||
if (error)
|
if (error)
|
||||||
return send_response(error, async_ready());
|
return send_response(error, async_ready());
|
||||||
if (!self_->timer.cancel(error))
|
if (!self_->timer.cancel())
|
||||||
return send_response(boost::asio::error::operation_aborted, async_ready());
|
return send_response(boost::asio::error::operation_aborted, async_ready());
|
||||||
|
|
||||||
distribution_rpc::Response distribution_resp{};
|
distribution_rpc::Response distribution_resp{};
|
||||||
|
@ -952,7 +952,7 @@ namespace lws
|
||||||
MERROR("Internal ZMQ error in /get_random_outs: " << error.message());
|
MERROR("Internal ZMQ error in /get_random_outs: " << error.message());
|
||||||
return {error::daemon_timeout};
|
return {error::daemon_timeout};
|
||||||
}
|
}
|
||||||
if (!self_.self_->timer.cancel(error))
|
if (!self_.self_->timer.cancel())
|
||||||
return {error::daemon_timeout};
|
return {error::daemon_timeout};
|
||||||
|
|
||||||
get_keys_rpc::Response keys_resp{};
|
get_keys_rpc::Response keys_resp{};
|
||||||
|
@ -1233,7 +1233,7 @@ namespace lws
|
||||||
self.client, self.in, boost::asio::bind_executor(self.strand, std::move(*this))
|
self.client, self.in, boost::asio::bind_executor(self.strand, std::move(*this))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!self.timer.cancel(error))
|
if (!self.timer.cancel())
|
||||||
return send_response(boost::asio::error::operation_aborted, default_response{});
|
return send_response(boost::asio::error::operation_aborted, default_response{});
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1579,7 +1579,7 @@ namespace lws
|
||||||
self.client, self.in, boost::asio::bind_executor(self.strand, std::move(*this))
|
self.client, self.in, boost::asio::bind_executor(self.strand, std::move(*this))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!self.timer.cancel(error))
|
if (!self.timer.cancel())
|
||||||
return send_response(boost::asio::error::operation_aborted, async_ready());
|
return send_response(boost::asio::error::operation_aborted, async_ready());
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -2021,7 +2021,7 @@ namespace lws
|
||||||
boost::system::error_code ec{};
|
boost::system::error_code ec{};
|
||||||
MDEBUG("Shutting down REST socket to " << this);
|
MDEBUG("Shutting down REST socket to " << this);
|
||||||
sock().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
|
sock().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
|
||||||
timer_.cancel(ec);
|
timer_.cancel();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2150,7 +2150,7 @@ namespace lws
|
||||||
);
|
);
|
||||||
|
|
||||||
// async_response will have its own timeouts set in handlers if async
|
// async_response will have its own timeouts set in handlers if async
|
||||||
if (!self.timer_.cancel(error))
|
if (!self.timer_.cancel())
|
||||||
return self.shutdown();
|
return self.shutdown();
|
||||||
|
|
||||||
/* async_response flow has MDEBUG statements for outgoing messages.
|
/* async_response flow has MDEBUG statements for outgoing messages.
|
||||||
|
@ -2249,8 +2249,7 @@ namespace lws
|
||||||
if (!https)
|
if (!https)
|
||||||
{
|
{
|
||||||
boost::system::error_code error{};
|
boost::system::error_code error{};
|
||||||
const boost::asio::ip::address ip_host =
|
const auto ip_host = boost::asio::ip::make_address(url.host, error);
|
||||||
ip_host.from_string(url.host, error);
|
|
||||||
if (error)
|
if (error)
|
||||||
MONERO_THROW(lws::error::configuration, "Invalid IP address for REST server");
|
MONERO_THROW(lws::error::configuration, "Invalid IP address for REST server");
|
||||||
if (!ip_host.is_loopback() && !config.allow_external)
|
if (!ip_host.is_loopback() && !config.allow_external)
|
||||||
|
@ -2310,7 +2309,7 @@ namespace lws
|
||||||
ssl_options.auth = std::move(config.auth);
|
ssl_options.auth = std::move(config.auth);
|
||||||
|
|
||||||
boost::asio::ip::tcp::endpoint endpoint{
|
boost::asio::ip::tcp::endpoint endpoint{
|
||||||
boost::asio::ip::address::from_string(url.host),
|
boost::asio::ip::make_address(url.host),
|
||||||
boost::lexical_cast<unsigned short>(url.port)
|
boost::lexical_cast<unsigned short>(url.port)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace lws { namespace rpc { namespace scanner
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
MINFO("Attempting connection to " << self_->server_address_);
|
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(
|
self_->connect_timer_.async_wait(
|
||||||
boost::asio::bind_executor(self_->strand_, close{self_})
|
boost::asio::bind_executor(self_->strand_, close{self_})
|
||||||
);
|
);
|
||||||
|
@ -139,7 +139,7 @@ namespace lws { namespace rpc { namespace scanner
|
||||||
break;
|
break;
|
||||||
|
|
||||||
MINFO("Retrying connection in " << std::chrono::seconds{reconnect_interval}.count() << " seconds");
|
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_CORO_YIELD self_->connect_timer_.async_wait(
|
||||||
boost::asio::bind_executor(self_->strand_, *this)
|
boost::asio::bind_executor(self_->strand_, *this)
|
||||||
);
|
);
|
||||||
|
|
|
@ -203,7 +203,7 @@ namespace lws { namespace rpc { namespace scanner
|
||||||
return;
|
return;
|
||||||
|
|
||||||
assert(self_->strand_.running_in_this_thread());
|
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));
|
self_->check_timer_.async_wait(boost::asio::bind_executor(self_->strand_, *this));
|
||||||
|
|
||||||
std::size_t total_threads = self_->local_.size();
|
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");
|
MDEBUG("Stopping rpc::scanner::server async operations");
|
||||||
boost::system::error_code error{};
|
boost::system::error_code error{};
|
||||||
check_timer_.cancel(error);
|
check_timer_.cancel();
|
||||||
acceptor_.cancel(error);
|
acceptor_.cancel(error);
|
||||||
acceptor_.close(error);
|
acceptor_.close(error);
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ namespace lws { namespace rpc { namespace scanner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return boost::asio::ip::tcp::endpoint{
|
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)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ namespace lws { namespace rpc { namespace scanner
|
||||||
{
|
{
|
||||||
while (!self_->write_bufs_.empty())
|
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_}));
|
self_->write_timeout_.async_wait(boost::asio::bind_executor(self_->strand_, timeout<T>{self_}));
|
||||||
BOOST_ASIO_CORO_YIELD boost::asio::async_write(
|
BOOST_ASIO_CORO_YIELD boost::asio::async_write(
|
||||||
self_->sock_, self_->write_buffer(), boost::asio::bind_executor(self_->strand_, *this)
|
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())
|
: 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()()
|
void operator()()
|
||||||
{
|
{
|
||||||
if (!self_)
|
if (!self_)
|
||||||
|
|
|
@ -1337,7 +1337,7 @@ namespace lws
|
||||||
const expect<void> status = ctx_.retrieve_rates_async(io_);
|
const expect<void> status = ctx_.retrieve_rates_async(io_);
|
||||||
if (!status)
|
if (!status)
|
||||||
MERROR("Unable to retrieve exchange rates: " << status.error());
|
MERROR("Unable to retrieve exchange rates: " << status.error());
|
||||||
rate_timer_.expires_from_now(rate_interval_);
|
rate_timer_.expires_after(rate_interval_);
|
||||||
rate_timer_.async_wait(*this);
|
rate_timer_.async_wait(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1382,7 +1382,7 @@ namespace lws
|
||||||
MINFO("No active accounts");
|
MINFO("No active accounts");
|
||||||
|
|
||||||
boost::asio::steady_timer poll{sync_.io_};
|
boost::asio::steady_timer poll{sync_.io_};
|
||||||
poll.expires_from_now(rpc::scanner::account_poll_interval);
|
poll.expires_after(rpc::scanner::account_poll_interval);
|
||||||
const auto ready = poll.async_wait(boost::asio::use_future);
|
const auto ready = poll.async_wait(boost::asio::use_future);
|
||||||
|
|
||||||
/* The exchange rates timer could run while waiting, so ensure that
|
/* The exchange rates timer could run while waiting, so ensure that
|
||||||
|
|
Loading…
Reference in a new issue