mirror of
https://github.com/wownero/wownero.git
synced 2026-11-12 19:33:54 +01:00
Fix build with boost ASIO 0.87. Support boost 1.66+
This commit is contained in:
+1
-1
@@ -936,7 +936,7 @@ std::string get_nix_version_display_string()
|
||||
}
|
||||
|
||||
boost::system::error_code ec;
|
||||
const auto parsed_ip = boost::asio::ip::address::from_string(u_c.host, ec);
|
||||
const auto parsed_ip = boost::asio::ip::make_address(u_c.host, ec);
|
||||
if (ec) {
|
||||
MDEBUG("Failed to parse '" << address << "' as IP address: " << ec.message() << ". Considering it not local");
|
||||
return false;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <boost/asio/dispatch.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <boost/format.hpp>
|
||||
@@ -375,9 +376,9 @@ bool Blockchain::init(BlockchainDB* db, const network_type nettype, bool offline
|
||||
|
||||
// create general purpose async service queue
|
||||
|
||||
m_async_work_idle = std::unique_ptr < boost::asio::io_service::work > (new boost::asio::io_service::work(m_async_service));
|
||||
m_async_work_idle = std::make_unique<boost::asio::executor_work_guard<boost::asio::io_context::executor_type>>(m_async_service.get_executor());
|
||||
// we only need 1
|
||||
m_async_pool.create_thread(boost::bind(&boost::asio::io_service::run, &m_async_service));
|
||||
m_async_pool.create_thread(boost::bind(&boost::asio::io_context::run, &m_async_service));
|
||||
|
||||
#if defined(PER_BLOCK_CHECKPOINT)
|
||||
if (m_nettype != FAKECHAIN)
|
||||
@@ -4760,7 +4761,7 @@ bool Blockchain::cleanup_handle_incoming_blocks(bool force_sync)
|
||||
{
|
||||
m_sync_counter = 0;
|
||||
m_bytes_to_sync = 0;
|
||||
m_async_service.dispatch(boost::bind(&Blockchain::store_blockchain, this));
|
||||
boost::asio::dispatch(m_async_service, boost::bind(&Blockchain::store_blockchain, this));
|
||||
}
|
||||
else if(m_db_sync_mode == db_sync)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
#pragma once
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/executor_work_guard.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/function/function_fwd.hpp>
|
||||
#if BOOST_VERSION >= 107400
|
||||
#include <boost/serialization/library_version_type.hpp>
|
||||
@@ -1185,9 +1186,9 @@ namespace cryptonote
|
||||
crypto::hash m_difficulty_for_next_block_top_hash;
|
||||
difficulty_type m_difficulty_for_next_block;
|
||||
|
||||
boost::asio::io_service m_async_service;
|
||||
boost::asio::io_context m_async_service;
|
||||
boost::thread_group m_async_pool;
|
||||
std::unique_ptr<boost::asio::io_service::work> m_async_work_idle;
|
||||
std::unique_ptr<boost::asio::executor_work_guard<boost::asio::io_context::executor_type>> m_async_work_idle;
|
||||
|
||||
// some invalid blocks
|
||||
blocks_ext_by_hash m_invalid_blocks; // crypto::hash -> block_extended_info
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
|
||||
#include "levin_notify.h"
|
||||
|
||||
#include <boost/asio/dispatch.hpp>
|
||||
#include <boost/asio/post.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <boost/system/system_error.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
@@ -221,7 +223,7 @@ namespace levin
|
||||
`dispatch` is used heavily, which means "execute immediately in _this_
|
||||
thread if the strand is not in use, otherwise queue the callback to be
|
||||
executed immediately after the strand completes its current task".
|
||||
`post` is used where deferred execution to an `asio::io_service::run`
|
||||
`post` is used where deferred execution to an `asio::io_context::run`
|
||||
thread is preferred.
|
||||
|
||||
The strand per "zone" is useful because the levin
|
||||
@@ -238,7 +240,7 @@ namespace levin
|
||||
//! A queue of levin messages for a noise i2p/tor link
|
||||
struct noise_channel
|
||||
{
|
||||
explicit noise_channel(boost::asio::io_service& io_service)
|
||||
explicit noise_channel(boost::asio::io_context& io_service)
|
||||
: active(nullptr),
|
||||
queue(),
|
||||
strand(io_service),
|
||||
@@ -246,7 +248,7 @@ namespace levin
|
||||
connection(boost::uuids::nil_uuid())
|
||||
{}
|
||||
|
||||
// `asio::io_service::strand` cannot be copied or moved
|
||||
// `asio::io_context::strand` cannot be copied or moved
|
||||
noise_channel(const noise_channel&) = delete;
|
||||
noise_channel& operator=(const noise_channel&) = delete;
|
||||
|
||||
@@ -254,7 +256,7 @@ namespace levin
|
||||
|
||||
epee::byte_slice active;
|
||||
std::deque<epee::byte_slice> queue;
|
||||
boost::asio::io_service::strand strand;
|
||||
boost::asio::io_context::strand strand;
|
||||
boost::asio::steady_timer next_noise;
|
||||
boost::uuids::uuid connection;
|
||||
};
|
||||
@@ -264,7 +266,7 @@ namespace levin
|
||||
{
|
||||
struct zone
|
||||
{
|
||||
explicit zone(boost::asio::io_service& io_service, std::shared_ptr<connections> p2p, epee::byte_slice noise_in, epee::net_utils::zone zone, bool pad_txs)
|
||||
explicit zone(boost::asio::io_context& io_service, std::shared_ptr<connections> p2p, epee::byte_slice noise_in, epee::net_utils::zone zone, bool pad_txs)
|
||||
: p2p(std::move(p2p)),
|
||||
noise(std::move(noise_in)),
|
||||
next_epoch(io_service),
|
||||
@@ -286,7 +288,7 @@ namespace levin
|
||||
const epee::byte_slice noise; //!< `!empty()` means zone is using noise channels
|
||||
boost::asio::steady_timer next_epoch;
|
||||
boost::asio::steady_timer flush_txs;
|
||||
boost::asio::io_service::strand strand;
|
||||
boost::asio::io_context::strand strand;
|
||||
struct context_t {
|
||||
std::vector<cryptonote::blobdata> fluff_txs;
|
||||
std::chrono::steady_clock::time_point flush_time;
|
||||
@@ -454,7 +456,7 @@ namespace levin
|
||||
|
||||
if (next_flush == std::chrono::steady_clock::time_point::max())
|
||||
MWARNING("Unable to send transaction(s), no available connections");
|
||||
else if (!zone->flush_callbacks || next_flush < zone->flush_txs.expires_at())
|
||||
else if (!zone->flush_callbacks || next_flush < zone->flush_txs.expiry())
|
||||
fluff_flush::queue(std::move(zone), next_flush);
|
||||
}
|
||||
};
|
||||
@@ -515,7 +517,7 @@ namespace levin
|
||||
for (auto id = zone->map.begin(); id != zone->map.end(); ++id)
|
||||
{
|
||||
const std::size_t i = id - zone->map.begin();
|
||||
zone->channels[i].strand.post(update_channel{zone, i, *id});
|
||||
boost::asio::post(zone->channels[i].strand, update_channel{zone, i, *id});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,7 +676,7 @@ namespace levin
|
||||
MWARNING("Unable to send transaction(s) to " << epee::net_utils::zone_to_string(zone_->nzone) <<
|
||||
" - no suitable outbound connections at height " << height);
|
||||
|
||||
zone_->strand.post(update_channels{zone_, std::move(connections)});
|
||||
boost::asio::post(zone_->strand, update_channels{zone_, std::move(connections)});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,7 +706,8 @@ namespace levin
|
||||
const bool fluffing = crypto::rand_idx(unsigned(100)) < CRYPTONOTE_DANDELIONPP_FLUFF_PROBABILITY;
|
||||
const auto start = std::chrono::steady_clock::now();
|
||||
auto connections = get_out_connections(*(zone_->p2p), core_);
|
||||
zone_->strand.dispatch(
|
||||
boost::asio::dispatch(
|
||||
zone_->strand,
|
||||
change_channels{zone_, net::dandelionpp::connection_map{std::move(connections), count_}, fluffing}
|
||||
);
|
||||
|
||||
@@ -715,7 +718,7 @@ namespace levin
|
||||
};
|
||||
} // anonymous
|
||||
|
||||
notify::notify(boost::asio::io_service& service, std::shared_ptr<connections> p2p, epee::byte_slice noise, epee::net_utils::zone zone, const bool pad_txs, i_core_events& core)
|
||||
notify::notify(boost::asio::io_context& service, std::shared_ptr<connections> p2p, epee::byte_slice noise, epee::net_utils::zone zone, const bool pad_txs, i_core_events& core)
|
||||
: zone_(std::make_shared<detail::zone>(service, std::move(p2p), std::move(noise), zone, pad_txs))
|
||||
, core_(std::addressof(core))
|
||||
{
|
||||
@@ -758,7 +761,8 @@ namespace levin
|
||||
if (!zone_ || zone_->noise.empty() || CRYPTONOTE_NOISE_CHANNELS <= zone_->connection_count)
|
||||
return;
|
||||
|
||||
zone_->strand.dispatch(
|
||||
boost::asio::dispatch(
|
||||
zone_->strand,
|
||||
update_channels{zone_, get_out_connections(*(zone_->p2p), core_)}
|
||||
);
|
||||
}
|
||||
@@ -769,7 +773,7 @@ namespace levin
|
||||
return;
|
||||
|
||||
auto& zone = zone_;
|
||||
zone_->strand.dispatch([zone, id, is_income]{
|
||||
boost::asio::dispatch(zone_->strand, [zone, id, is_income] {
|
||||
zone->contexts[id] = {
|
||||
.fluff_txs = {},
|
||||
.flush_time = std::chrono::steady_clock::time_point::max(),
|
||||
@@ -784,7 +788,7 @@ namespace levin
|
||||
return;
|
||||
|
||||
auto& zone = zone_;
|
||||
zone_->strand.dispatch([zone, id]{
|
||||
boost::asio::dispatch(zone_->strand, [zone, id]{
|
||||
zone->contexts.erase(id);
|
||||
});
|
||||
}
|
||||
@@ -859,7 +863,8 @@ namespace levin
|
||||
|
||||
for (std::size_t channel = 0; channel < zone_->channels.size(); ++channel)
|
||||
{
|
||||
zone_->channels[channel].strand.dispatch(
|
||||
boost::asio::dispatch(
|
||||
zone_->channels[channel].strand,
|
||||
queue_covert_notify{zone_, message.clone(), channel}
|
||||
);
|
||||
}
|
||||
@@ -878,7 +883,8 @@ namespace levin
|
||||
if (zone_->nzone == epee::net_utils::zone::public_)
|
||||
{
|
||||
// this will change a local/forward tx to stem or fluff ...
|
||||
zone_->strand.dispatch(
|
||||
boost::asio::dispatch(
|
||||
zone_->strand,
|
||||
dandelionpp_notify{zone_, core_, std::move(txs), source, tx_relay}
|
||||
);
|
||||
break;
|
||||
@@ -891,7 +897,7 @@ namespace levin
|
||||
ipv4/6. Marking it as "fluff" here will make the tx immediately
|
||||
visible externally from this node, which is not desired. */
|
||||
core_->on_transactions_relayed(epee::to_span(txs), tx_relay);
|
||||
zone_->strand.dispatch(fluff_notify{zone_, std::move(txs), source});
|
||||
boost::asio::dispatch(zone_->strand, fluff_notify{zone_, std::move(txs), source});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -86,7 +86,7 @@ namespace levin
|
||||
{}
|
||||
|
||||
//! Construct an instance with available notification `zones`.
|
||||
explicit notify(boost::asio::io_service& service, std::shared_ptr<connections> p2p, epee::byte_slice noise, epee::net_utils::zone zone, bool pad_txs, i_core_events& core);
|
||||
explicit notify(boost::asio::io_context& service, std::shared_ptr<connections> p2p, epee::byte_slice noise, epee::net_utils::zone zone, bool pad_txs, i_core_events& core);
|
||||
|
||||
notify(const notify&) = delete;
|
||||
notify(notify&&) = default;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <boost/endian/conversion.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/ip/udp.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/format.hpp>
|
||||
@@ -614,8 +613,7 @@ namespace trezor{
|
||||
}
|
||||
|
||||
udp::resolver resolver(m_io_service);
|
||||
udp::resolver::query query(udp::v4(), m_device_host, std::to_string(m_device_port));
|
||||
m_endpoint = *resolver.resolve(query);
|
||||
m_endpoint = *resolver.resolve(udp::v4(), m_device_host, std::to_string(m_device_port)).begin();
|
||||
|
||||
m_socket.reset(new udp::socket(m_io_service));
|
||||
m_socket->open(udp::v4());
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace trezor {
|
||||
int m_device_port;
|
||||
|
||||
std::unique_ptr<udp::socket> m_socket;
|
||||
boost::asio::io_service m_io_service;
|
||||
boost::asio::io_context m_io_service;
|
||||
boost::asio::deadline_timer m_deadline;
|
||||
udp::endpoint m_endpoint;
|
||||
};
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ namespace net
|
||||
return i2p_address::make(address);
|
||||
|
||||
boost::system::error_code ec;
|
||||
boost::asio::ip::address_v6 v6 = boost::asio::ip::address_v6::from_string(host_str, ec);
|
||||
boost::asio::ip::address_v6 v6 = boost::asio::ip::make_address_v6(host_str, ec);
|
||||
ipv6 = !ec;
|
||||
|
||||
std::uint16_t port = default_port;
|
||||
|
||||
+10
-8
@@ -29,7 +29,9 @@
|
||||
#include "socks.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/asio/bind_executor.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/asio/dispatch.hpp>
|
||||
#include <boost/asio/read.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
#include <boost/endian/arithmetic.hpp>
|
||||
@@ -176,7 +178,7 @@ namespace socks
|
||||
{
|
||||
std::shared_ptr<client> self_;
|
||||
|
||||
static boost::asio::mutable_buffers_1 get_buffer(client& self) noexcept
|
||||
static boost::asio::mutable_buffer get_buffer(client& self) noexcept
|
||||
{
|
||||
static_assert(sizeof(v4_header) <= sizeof(self.buffer_), "buffer too small for v4 response");
|
||||
return boost::asio::buffer(self.buffer_, sizeof(v4_header));
|
||||
@@ -192,7 +194,7 @@ namespace socks
|
||||
else if (bytes < self.buffer().size())
|
||||
self.done(socks::error::bad_write, std::move(self_));
|
||||
else
|
||||
boost::asio::async_read(self.proxy_, get_buffer(self), self.strand_.wrap(completed{std::move(self_)}));
|
||||
boost::asio::async_read(self.proxy_, get_buffer(self), boost::asio::bind_executor(self.strand_, completed{std::move(self_)}));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -201,7 +203,7 @@ namespace socks
|
||||
{
|
||||
std::shared_ptr<client> self_;
|
||||
|
||||
static boost::asio::const_buffers_1 get_buffer(client const& self) noexcept
|
||||
static boost::asio::const_buffer get_buffer(client const& self) noexcept
|
||||
{
|
||||
return boost::asio::buffer(self.buffer_, self.buffer_size_);
|
||||
}
|
||||
@@ -214,13 +216,13 @@ namespace socks
|
||||
if (error)
|
||||
self.done(error, std::move(self_));
|
||||
else
|
||||
boost::asio::async_write(self.proxy_, get_buffer(self), self.strand_.wrap(read{std::move(self_)}));
|
||||
boost::asio::async_write(self.proxy_, get_buffer(self), boost::asio::bind_executor(self.strand_, read{std::move(self_)}));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
client::client(stream_type::socket&& proxy, socks::version ver)
|
||||
: proxy_(std::move(proxy)), strand_(GET_IO_SERVICE(proxy_)), buffer_size_(0), buffer_(), ver_(ver)
|
||||
: proxy_(std::move(proxy)), strand_(proxy_.get_executor()), buffer_size_(0), buffer_(), ver_(ver)
|
||||
{}
|
||||
|
||||
client::~client() {}
|
||||
@@ -295,7 +297,7 @@ namespace socks
|
||||
if (self && !self->buffer().empty())
|
||||
{
|
||||
client& alias = *self;
|
||||
alias.proxy_.async_connect(proxy_address, alias.strand_.wrap(write{std::move(self)}));
|
||||
alias.proxy_.async_connect(proxy_address, boost::asio::bind_executor(alias.strand_, write{std::move(self)}));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -306,7 +308,7 @@ namespace socks
|
||||
if (self && !self->buffer().empty())
|
||||
{
|
||||
client& alias = *self;
|
||||
boost::asio::async_write(alias.proxy_, write::get_buffer(alias), alias.strand_.wrap(read{std::move(self)}));
|
||||
boost::asio::async_write(alias.proxy_, write::get_buffer(alias), boost::asio::bind_executor(alias.strand_, read{std::move(self)}));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -317,7 +319,7 @@ namespace socks
|
||||
if (self_ && error != boost::system::errc::operation_canceled)
|
||||
{
|
||||
const std::shared_ptr<client> self = std::move(self_);
|
||||
self->strand_.dispatch([self] ()
|
||||
boost::asio::dispatch(self->strand_, [self] ()
|
||||
{
|
||||
if (self && self->proxy_.is_open())
|
||||
{
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/strand.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
@@ -93,7 +93,7 @@ namespace socks
|
||||
class client
|
||||
{
|
||||
boost::asio::ip::tcp::socket proxy_;
|
||||
boost::asio::io_service::strand strand_;
|
||||
boost::asio::strand<boost::asio::ip::tcp::socket::executor_type> strand_;
|
||||
std::uint16_t buffer_size_;
|
||||
std::uint8_t buffer_[1024];
|
||||
socks::version ver_;
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace socks
|
||||
boost::promise<boost::asio::ip::tcp::socket> result{};
|
||||
out = result.get_future();
|
||||
const auto proxy = net::socks::make_connect_client(
|
||||
boost::asio::ip::tcp::socket{GET_IO_SERVICE(timeout)}, net::socks::version::v4a, future_socket{std::move(result)}
|
||||
boost::asio::ip::tcp::socket{MONERO_GET_EXECUTOR(timeout)}, net::socks::version::v4a, future_socket{std::move(result)}
|
||||
);
|
||||
|
||||
if (epee::string_tools::get_ip_int32_from_string(ip_address, remote_host))
|
||||
|
||||
@@ -327,7 +327,7 @@ namespace nodetool
|
||||
}
|
||||
|
||||
boost::optional<boost::asio::ip::tcp::socket>
|
||||
socks_connect_internal(const std::atomic<bool>& stop_signal, boost::asio::io_service& service, const boost::asio::ip::tcp::endpoint& proxy, const epee::net_utils::network_address& remote)
|
||||
socks_connect_internal(const std::atomic<bool>& stop_signal, boost::asio::io_context& service, const boost::asio::ip::tcp::endpoint& proxy, const epee::net_utils::network_address& remote)
|
||||
{
|
||||
using socket_type = net::socks::client::stream_type::socket;
|
||||
using client_result = std::pair<boost::system::error_code, socket_type>;
|
||||
|
||||
+3
-3
@@ -31,7 +31,7 @@
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/optional/optional_fwd.hpp>
|
||||
@@ -104,7 +104,7 @@ namespace nodetool
|
||||
|
||||
// hides boost::future and chrono stuff from mondo template file
|
||||
boost::optional<boost::asio::ip::tcp::socket>
|
||||
socks_connect_internal(const std::atomic<bool>& stop_signal, boost::asio::io_service& service, const boost::asio::ip::tcp::endpoint& proxy, const epee::net_utils::network_address& remote);
|
||||
socks_connect_internal(const std::atomic<bool>& stop_signal, boost::asio::io_context& service, const boost::asio::ip::tcp::endpoint& proxy, const epee::net_utils::network_address& remote);
|
||||
|
||||
|
||||
template<class base_type>
|
||||
@@ -181,7 +181,7 @@ namespace nodetool
|
||||
set_config_defaults();
|
||||
}
|
||||
|
||||
network_zone(boost::asio::io_service& public_service)
|
||||
network_zone(boost::asio::io_context& public_service)
|
||||
: m_connect(nullptr),
|
||||
m_net_server(public_service, epee::net_utils::e_connection_type_P2P),
|
||||
m_seed_nodes(),
|
||||
|
||||
+12
-14
@@ -87,7 +87,7 @@ namespace nodetool
|
||||
template<class t_payload_net_handler>
|
||||
node_server<t_payload_net_handler>::~node_server()
|
||||
{
|
||||
// tcp server uses io_service in destructor, and every zone uses
|
||||
// tcp server uses io_context in destructor, and every zone uses
|
||||
// io_service from public zone.
|
||||
for (auto current = m_network_zones.begin(); current != m_network_zones.end(); /* below */)
|
||||
{
|
||||
@@ -476,7 +476,7 @@ namespace nodetool
|
||||
m_use_ipv6 = command_line::get_arg(vm, arg_p2p_use_ipv6);
|
||||
m_require_ipv4 = !command_line::get_arg(vm, arg_p2p_ignore_ipv4);
|
||||
public_zone.m_notifier = cryptonote::levin::notify{
|
||||
public_zone.m_net_server.get_io_service(), public_zone.m_net_server.get_config_shared(), nullptr, epee::net_utils::zone::public_, pad_txs, m_payload_handler.get_core()
|
||||
public_zone.m_net_server.get_io_context(), public_zone.m_net_server.get_config_shared(), nullptr, epee::net_utils::zone::public_, pad_txs, m_payload_handler.get_core()
|
||||
};
|
||||
|
||||
if (command_line::has_arg(vm, arg_p2p_add_peer))
|
||||
@@ -639,7 +639,7 @@ namespace nodetool
|
||||
}
|
||||
|
||||
zone.m_notifier = cryptonote::levin::notify{
|
||||
zone.m_net_server.get_io_service(), zone.m_net_server.get_config_shared(), std::move(this_noise), proxy.zone, pad_txs, m_payload_handler.get_core()
|
||||
zone.m_net_server.get_io_context(), zone.m_net_server.get_config_shared(), std::move(this_noise), proxy.zone, pad_txs, m_payload_handler.get_core()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -701,20 +701,18 @@ namespace nodetool
|
||||
net::get_network_address_host_and_port(addr, host, port);
|
||||
MINFO("Resolving node address: host=" << host << ", port=" << port);
|
||||
|
||||
io_service io_srv;
|
||||
ip::tcp::resolver resolver(io_srv);
|
||||
ip::tcp::resolver::query query(host, port, boost::asio::ip::tcp::resolver::query::canonical_name);
|
||||
boost::system::error_code ec;
|
||||
ip::tcp::resolver::iterator i = resolver.resolve(query, ec);
|
||||
CHECK_AND_ASSERT_MES(!ec, false, "Failed to resolve host name '" << host << "': " << ec.message() << ':' << ec.value());
|
||||
io_context io_srv;
|
||||
ip::tcp::resolver resolver(io_srv);
|
||||
const auto results = resolver.resolve(host, port, boost::asio::ip::tcp::resolver::canonical_name, ec);
|
||||
CHECK_AND_ASSERT_MES(!ec && !results.empty(), false, "Failed to resolve host name '" << host << "': " << ec.message() << ':' << ec.value());
|
||||
|
||||
ip::tcp::resolver::iterator iend;
|
||||
for (; i != iend; ++i)
|
||||
for (const auto& result : results)
|
||||
{
|
||||
ip::tcp::endpoint endpoint = *i;
|
||||
const auto& endpoint = result.endpoint();
|
||||
if (endpoint.address().is_v4())
|
||||
{
|
||||
epee::net_utils::network_address na{epee::net_utils::ipv4_network_address{boost::asio::detail::socket_ops::host_to_network_long(endpoint.address().to_v4().to_ulong()), endpoint.port()}};
|
||||
epee::net_utils::network_address na{epee::net_utils::ipv4_network_address{boost::asio::detail::socket_ops::host_to_network_long(endpoint.address().to_v4().to_uint()), endpoint.port()}};
|
||||
seed_nodes.push_back(na);
|
||||
MINFO("Added node: " << na.str());
|
||||
}
|
||||
@@ -924,7 +922,7 @@ namespace nodetool
|
||||
return zone_->second;
|
||||
|
||||
network_zone& public_zone = m_network_zones[epee::net_utils::zone::public_];
|
||||
return m_network_zones.emplace_hint(zone_, std::piecewise_construct, std::make_tuple(zone), std::tie(public_zone.m_net_server.get_io_service()))->second;
|
||||
return m_network_zones.emplace_hint(zone_, std::piecewise_construct, std::make_tuple(zone), std::tie(public_zone.m_net_server.get_io_context()))->second;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------
|
||||
template<class t_payload_net_handler>
|
||||
@@ -3129,7 +3127,7 @@ namespace nodetool
|
||||
boost::optional<p2p_connection_context_t<typename t_payload_net_handler::connection_context>>
|
||||
node_server<t_payload_net_handler>::socks_connect(network_zone& zone, const epee::net_utils::network_address& remote, epee::net_utils::ssl_support_t ssl_support)
|
||||
{
|
||||
auto result = socks_connect_internal(zone.m_net_server.get_stop_signal(), zone.m_net_server.get_io_service(), zone.m_proxy_address, remote);
|
||||
auto result = socks_connect_internal(zone.m_net_server.get_stop_signal(), zone.m_net_server.get_io_context(), zone.m_proxy_address, remote);
|
||||
if (result) // if no error
|
||||
{
|
||||
p2p_connection_context context{};
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace cryptonote
|
||||
{
|
||||
// always parse IP here for error consistency
|
||||
boost::system::error_code ec{};
|
||||
const auto parsed_ip = boost::asio::ip::address::from_string(config.bind_ip, ec);
|
||||
const auto parsed_ip = boost::asio::ip::make_address(config.bind_ip, ec);
|
||||
if (ec)
|
||||
{
|
||||
LOG_ERROR(tr("Invalid IP address given for --") << arg.rpc_bind_ip.name);
|
||||
@@ -177,7 +177,7 @@ namespace cryptonote
|
||||
|
||||
// always parse IP here for error consistency
|
||||
boost::system::error_code ec{};
|
||||
const auto parsed_ip = boost::asio::ip::address::from_string(config.bind_ipv6_address, ec);
|
||||
const auto parsed_ip = boost::asio::ip::make_address(config.bind_ipv6_address, ec);
|
||||
if (ec)
|
||||
{
|
||||
LOG_ERROR(tr("Invalid IP address given for --") << arg.rpc_bind_ipv6_address.name);
|
||||
@@ -198,7 +198,7 @@ namespace cryptonote
|
||||
{
|
||||
// always parse IP here for error consistency
|
||||
boost::system::error_code ec{};
|
||||
boost::asio::ip::address::from_string(config.restricted_bind_ip, ec);
|
||||
boost::asio::ip::make_address(config.restricted_bind_ip, ec);
|
||||
if (ec)
|
||||
{
|
||||
LOG_ERROR(tr("Invalid IP address given for --") << arg.rpc_restricted_bind_ip.name);
|
||||
@@ -215,7 +215,7 @@ namespace cryptonote
|
||||
|
||||
// always parse IP here for error consistency
|
||||
boost::system::error_code ec{};
|
||||
boost::asio::ip::address::from_string(config.restricted_bind_ipv6_address, ec);
|
||||
boost::asio::ip::make_address(config.restricted_bind_ipv6_address, ec);
|
||||
if (ec)
|
||||
{
|
||||
LOG_ERROR(tr("Invalid IP address given for --") << arg.rpc_restricted_bind_ipv6_address.name);
|
||||
|
||||
Reference in New Issue
Block a user