aboutsummaryrefslogtreecommitdiff
path: root/src/p2p
diff options
context:
space:
mode:
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/CMakeLists.txt2
-rw-r--r--src/p2p/net_node.cpp17
-rw-r--r--src/p2p/net_node.h23
-rw-r--r--src/p2p/net_node.inl38
-rw-r--r--src/p2p/net_node_common.h2
-rw-r--r--src/p2p/net_peerlist.h7
-rw-r--r--src/p2p/net_peerlist_boost_serialization.h56
-rw-r--r--src/p2p/p2p_protocol_defs.h65
-rw-r--r--src/p2p/stdafx.h2
9 files changed, 161 insertions, 51 deletions
diff --git a/src/p2p/CMakeLists.txt b/src/p2p/CMakeLists.txt
index 9a1730b8a..3aecc3cf9 100644
--- a/src/p2p/CMakeLists.txt
+++ b/src/p2p/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2018, The Monero Project
+# Copyright (c) 2014-2019, The Monero Project
#
# All rights reserved.
#
diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp
index 8639fdb3b..e0f1de14a 100644
--- a/src/p2p/net_node.cpp
+++ b/src/p2p/net_node.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2018, The Monero Project
+// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//
@@ -46,13 +46,14 @@
#include "net/socks.h"
#include "net/parse.h"
#include "net/tor_address.h"
+#include "net/i2p_address.h"
#include "p2p/p2p_protocol_defs.h"
#include "string_tools.h"
namespace
{
constexpr const boost::chrono::milliseconds future_poll_interval{500};
- constexpr const std::chrono::seconds tor_connect_timeout{P2P_DEFAULT_TOR_CONNECT_TIMEOUT};
+ constexpr const std::chrono::seconds socks_connect_timeout{P2P_DEFAULT_SOCKS_CONNECT_TIMEOUT};
std::int64_t get_max_connections(const boost::iterator_range<boost::string_ref::const_iterator> value) noexcept
{
@@ -90,6 +91,9 @@ namespace
case net::tor_address::get_type_id():
set = client->set_connect_command(remote.as<net::tor_address>());
break;
+ case net::i2p_address::get_type_id():
+ set = client->set_connect_command(remote.as<net::i2p_address>());
+ break;
default:
MERROR("Unsupported network address in socks_connect");
return false;
@@ -177,6 +181,9 @@ namespace nodetool
case epee::net_utils::zone::tor:
proxies.back().zone = epee::net_utils::zone::tor;
break;
+ case epee::net_utils::zone::i2p:
+ proxies.back().zone = epee::net_utils::zone::i2p;
+ break;
default:
MERROR("Invalid network for --" << arg_proxy.name);
return boost::none;
@@ -235,6 +242,10 @@ namespace nodetool
inbounds.back().our_address = std::move(*our_address);
inbounds.back().default_remote = net::tor_address::unknown();
break;
+ case net::i2p_address::get_type_id():
+ inbounds.back().our_address = std::move(*our_address);
+ inbounds.back().default_remote = net::i2p_address::unknown();
+ break;
default:
MERROR("Invalid inbound address (" << address << ") for --" << arg_anonymous_inbound.name << ": " << (our_address ? "invalid type" : our_address.error().message()));
return boost::none;
@@ -308,7 +319,7 @@ namespace nodetool
const auto start = std::chrono::steady_clock::now();
while (socks_result.wait_for(future_poll_interval) == boost::future_status::timeout)
{
- if (tor_connect_timeout < std::chrono::steady_clock::now() - start)
+ if (socks_connect_timeout < std::chrono::steady_clock::now() - start)
{
MERROR("Timeout on socks connect (" << proxy << " to " << remote.str() << ")");
return boost::none;
diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h
index 112f30fb6..7840e3832 100644
--- a/src/p2p/net_node.h
+++ b/src/p2p/net_node.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2018, The Monero Project
+// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//
@@ -129,11 +129,11 @@ namespace nodetool
typedef epee::net_utils::boosted_tcp_server<epee::levin::async_protocol_handler<p2p_connection_context>> net_server;
struct network_zone;
- using connect_func = boost::optional<p2p_connection_context>(network_zone&, epee::net_utils::network_address const&);
+ using connect_func = boost::optional<p2p_connection_context>(network_zone&, epee::net_utils::network_address const&, epee::net_utils::ssl_support_t);
- struct config
+ struct config_t
{
- config()
+ config_t()
: m_net_config(),
m_peer_id(crypto::rand<uint64_t>()),
m_support_flags(0)
@@ -143,6 +143,7 @@ namespace nodetool
uint64_t m_peer_id;
uint32_t m_support_flags;
};
+ typedef epee::misc_utils::struct_init<config_t> config;
struct network_zone
{
@@ -210,6 +211,7 @@ namespace nodetool
node_server(t_payload_net_handler& payload_handler)
: m_payload_handler(payload_handler),
m_external_port(0),
+ m_rpc_port(0),
m_allow_local_ip(false),
m_hide_my_port(false),
m_no_igd(false),
@@ -399,6 +401,12 @@ namespace nodetool
m_save_graph = save_graph;
epee::net_utils::connection_basic::set_save_graph(save_graph);
}
+
+ void set_rpc_port(uint16_t rpc_port)
+ {
+ m_rpc_port = rpc_port;
+ }
+
private:
std::string m_config_folder;
@@ -406,6 +414,7 @@ namespace nodetool
bool m_first_connection_maker_call;
uint32_t m_listening_port;
uint32_t m_external_port;
+ uint16_t m_rpc_port;
bool m_allow_local_ip;
bool m_hide_my_port;
bool m_no_igd;
@@ -437,8 +446,8 @@ namespace nodetool
//keep connections to initiate some interactions
- static boost::optional<p2p_connection_context> public_connect(network_zone&, epee::net_utils::network_address const&);
- static boost::optional<p2p_connection_context> socks_connect(network_zone&, epee::net_utils::network_address const&);
+ static boost::optional<p2p_connection_context> public_connect(network_zone&, epee::net_utils::network_address const&, epee::net_utils::ssl_support_t);
+ static boost::optional<p2p_connection_context> socks_connect(network_zone&, epee::net_utils::network_address const&, epee::net_utils::ssl_support_t);
/* A `std::map` provides constant iterators and key/value pointers even with
@@ -463,6 +472,8 @@ namespace nodetool
boost::uuids::uuid m_network_id;
cryptonote::network_type m_nettype;
+
+ epee::net_utils::ssl_support_t m_ssl_support;
};
const int64_t default_limit_up = P2P_DEFAULT_LIMIT_RATE_UP; // kB/s
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 471fdda0d..3542357dc 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2018, The Monero Project
+// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//
@@ -650,6 +650,7 @@ namespace nodetool
return res;
//try to bind
+ m_ssl_support = epee::net_utils::ssl_support_t::e_ssl_support_disabled;
for (auto& zone : m_network_zones)
{
zone.second.m_net_server.get_config_object().set_handler(this);
@@ -659,7 +660,7 @@ namespace nodetool
{
zone.second.m_net_server.set_connection_filter(this);
MINFO("Binding on " << zone.second.m_bind_ip << ":" << zone.second.m_port);
- res = zone.second.m_net_server.init_server(zone.second.m_port, zone.second.m_bind_ip);
+ res = zone.second.m_net_server.init_server(zone.second.m_port, zone.second.m_bind_ip, epee::net_utils::ssl_support_t::e_ssl_support_disabled);
CHECK_AND_ASSERT_MES(res, false, "Failed to bind server");
}
}
@@ -864,7 +865,8 @@ namespace nodetool
}
pi = context.peer_id = rsp.node_data.peer_id;
- m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.set_peer_just_seen(rsp.node_data.peer_id, context.m_remote_address, context.m_pruning_seed);
+ context.m_rpc_port = rsp.node_data.rpc_port;
+ m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.set_peer_just_seen(rsp.node_data.peer_id, context.m_remote_address, context.m_pruning_seed, context.m_rpc_port);
// move
for (auto const& zone : m_network_zones)
@@ -930,7 +932,7 @@ namespace nodetool
add_host_fail(context.m_remote_address);
}
if(!context.m_is_income)
- m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.set_peer_just_seen(context.peer_id, context.m_remote_address, context.m_pruning_seed);
+ m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.set_peer_just_seen(context.peer_id, context.m_remote_address, context.m_pruning_seed, context.m_rpc_port);
m_payload_handler.process_payload_sync_data(rsp.payload_data, context, false);
});
@@ -1057,7 +1059,7 @@ namespace nodetool
<< (last_seen_stamp ? epee::misc_utils::get_time_interval_string(time(NULL) - last_seen_stamp):"never")
<< ")...");
- auto con = zone.m_connect(zone, na);
+ auto con = zone.m_connect(zone, na, m_ssl_support);
if(!con)
{
bool is_priority = is_priority_node(na);
@@ -1094,6 +1096,7 @@ namespace nodetool
time(&last_seen);
pe_local.last_seen = static_cast<int64_t>(last_seen);
pe_local.pruning_seed = con->m_pruning_seed;
+ pe_local.rpc_port = con->m_rpc_port;
zone.m_peerlist.append_with_peer_white(pe_local);
//update last seen and push it to peerlist manager
@@ -1119,7 +1122,7 @@ namespace nodetool
<< (last_seen_stamp ? epee::misc_utils::get_time_interval_string(time(NULL) - last_seen_stamp):"never")
<< ")...");
- auto con = zone.m_connect(zone, na);
+ auto con = zone.m_connect(zone, na, m_ssl_support);
if (!con) {
bool is_priority = is_priority_node(na);
@@ -1397,7 +1400,15 @@ namespace nodetool
}
if(zone.second.m_net_server.is_stop_signal_sent())
return false;
- conn_count = get_outgoing_connections_count(zone.second);
+ size_t new_conn_count = get_outgoing_connections_count(zone.second);
+ if (new_conn_count <= conn_count)
+ {
+ // we did not make any connection, sleep a bit to avoid a busy loop in case we don't have
+ // any peers to try, then break so we will try seeds to get more peers
+ boost::this_thread::sleep_for(boost::chrono::seconds(1));
+ break;
+ }
+ conn_count = new_conn_count;
}
}
@@ -1648,6 +1659,7 @@ namespace nodetool
node_data.my_port = m_external_port ? m_external_port : m_listening_port;
else
node_data.my_port = 0;
+ node_data.rpc_port = zone.m_can_pingback ? m_rpc_port : 0;
node_data.network_id = m_network_id;
return true;
}
@@ -2003,6 +2015,7 @@ namespace nodetool
//associate peer_id with this connection
context.peer_id = arg.node_data.peer_id;
context.m_in_timedsync = false;
+ context.m_rpc_port = arg.node_data.rpc_port;
if(arg.node_data.peer_id != zone.m_config.m_peer_id && arg.node_data.my_port && zone.m_can_pingback)
{
@@ -2022,6 +2035,7 @@ namespace nodetool
pe.last_seen = static_cast<int64_t>(last_seen);
pe.id = peer_id_l;
pe.pruning_seed = context.m_pruning_seed;
+ pe.rpc_port = context.m_rpc_port;
this->m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.append_with_peer_white(pe);
LOG_DEBUG_CC(context, "PING SUCCESS " << context.m_remote_address.host_str() << ":" << port_l);
});
@@ -2322,7 +2336,7 @@ namespace nodetool
}
else
{
- zone.second.m_peerlist.set_peer_just_seen(pe.id, pe.adr, pe.pruning_seed);
+ zone.second.m_peerlist.set_peer_just_seen(pe.id, pe.adr, pe.pruning_seed, pe.rpc_port);
LOG_PRINT_L2("PEER PROMOTED TO WHITE PEER LIST IP address: " << pe.adr.host_str() << " Peer ID: " << peerid_type(pe.id));
}
}
@@ -2456,13 +2470,13 @@ namespace nodetool
template<typename t_payload_net_handler>
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)
+ 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);
if (result) // if no error
{
p2p_connection_context context{};
- if (zone.m_net_server.add_connection(context, std::move(*result), remote))
+ if (zone.m_net_server.add_connection(context, std::move(*result), remote, ssl_support))
return {std::move(context)};
}
return boost::none;
@@ -2470,7 +2484,7 @@ namespace nodetool
template<typename t_payload_net_handler>
boost::optional<p2p_connection_context_t<typename t_payload_net_handler::connection_context>>
- node_server<t_payload_net_handler>::public_connect(network_zone& zone, epee::net_utils::network_address const& na)
+ node_server<t_payload_net_handler>::public_connect(network_zone& zone, epee::net_utils::network_address const& na, epee::net_utils::ssl_support_t ssl_support)
{
CHECK_AND_ASSERT_MES(na.get_type_id() == epee::net_utils::ipv4_network_address::get_type_id(), boost::none,
"Only IPv4 addresses are supported here");
@@ -2480,7 +2494,7 @@ namespace nodetool
const bool res = zone.m_net_server.connect(epee::string_tools::get_ip_string_from_int32(ipv4.ip()),
epee::string_tools::num_to_string_fast(ipv4.port()),
zone.m_config.m_net_config.connection_timeout,
- con);
+ con, "0.0.0.0", ssl_support);
if (res)
return {std::move(con)};
diff --git a/src/p2p/net_node_common.h b/src/p2p/net_node_common.h
index 944bf48e4..26451b333 100644
--- a/src/p2p/net_node_common.h
+++ b/src/p2p/net_node_common.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2018, The Monero Project
+// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//
diff --git a/src/p2p/net_peerlist.h b/src/p2p/net_peerlist.h
index 46726d7d8..ebe0268d8 100644
--- a/src/p2p/net_peerlist.h
+++ b/src/p2p/net_peerlist.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2018, The Monero Project
+// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//
@@ -111,7 +111,7 @@ namespace nodetool
bool append_with_peer_white(const peerlist_entry& pr);
bool append_with_peer_gray(const peerlist_entry& pr);
bool append_with_peer_anchor(const anchor_peerlist_entry& ple);
- bool set_peer_just_seen(peerid_type peer, const epee::net_utils::network_address& addr, uint32_t pruning_seed);
+ bool set_peer_just_seen(peerid_type peer, const epee::net_utils::network_address& addr, uint32_t pruning_seed, uint16_t rpc_port);
bool set_peer_unreachable(const peerlist_entry& pr);
bool is_host_allowed(const epee::net_utils::network_address &address);
bool get_random_gray_peer(peerlist_entry& pe);
@@ -295,7 +295,7 @@ namespace nodetool
}
//--------------------------------------------------------------------------------------------------
inline
- bool peerlist_manager::set_peer_just_seen(peerid_type peer, const epee::net_utils::network_address& addr, uint32_t pruning_seed)
+ bool peerlist_manager::set_peer_just_seen(peerid_type peer, const epee::net_utils::network_address& addr, uint32_t pruning_seed, uint16_t rpc_port)
{
TRY_ENTRY();
CRITICAL_REGION_LOCAL(m_peerlist_lock);
@@ -305,6 +305,7 @@ namespace nodetool
ple.id = peer;
ple.last_seen = time(NULL);
ple.pruning_seed = pruning_seed;
+ ple.rpc_port = rpc_port;
return append_with_peer_white(ple);
CATCH_ENTRY_L0("peerlist_manager::set_peer_just_seen()", false);
}
diff --git a/src/p2p/net_peerlist_boost_serialization.h b/src/p2p/net_peerlist_boost_serialization.h
index d2e9efa3d..40ef2ebcd 100644
--- a/src/p2p/net_peerlist_boost_serialization.h
+++ b/src/p2p/net_peerlist_boost_serialization.h
@@ -1,4 +1,4 @@
- // Copyright (c) 2014-2018, The Monero Project
+// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//
@@ -35,12 +35,15 @@
#include "common/expect.h"
#include "net/net_utils_base.h"
#include "net/tor_address.h"
+#include "net/i2p_address.h"
#include "p2p/p2p_protocol_defs.h"
#ifdef CRYPTONOTE_PRUNING_DEBUG_SPOOF_SEED
#include "common/pruning.h"
#endif
+BOOST_CLASS_VERSION(nodetool::peerlist_entry, 2)
+
namespace boost
{
namespace serialization
@@ -76,6 +79,9 @@ namespace boost
case net::tor_address::get_type_id():
do_serialize<net::tor_address>(is_saving, a, na);
break;
+ case net::i2p_address::get_type_id():
+ do_serialize<net::i2p_address>(is_saving, a, na);
+ break;
case epee::net_utils::address_type::invalid:
default:
throw std::runtime_error("Unsupported network address type");
@@ -107,6 +113,20 @@ namespace boost
}
template <class Archive, class ver_type>
+ inline void save(Archive& a, const net::i2p_address& na, const ver_type)
+ {
+ const size_t length = std::strlen(na.host_str());
+ if (length > 255)
+ MONERO_THROW(net::error::invalid_i2p_address, "i2p address too long");
+
+ const uint16_t port{na.port()};
+ const uint8_t len = length;
+ a & port;
+ a & len;
+ a.save_binary(na.host_str(), length);
+ }
+
+ template <class Archive, class ver_type>
inline void load(Archive& a, net::tor_address& na, const ver_type)
{
uint16_t port = 0;
@@ -128,12 +148,39 @@ namespace boost
}
template <class Archive, class ver_type>
+ inline void load(Archive& a, net::i2p_address& na, const ver_type)
+ {
+ uint16_t port = 0;
+ uint8_t length = 0;
+ a & port;
+ a & length;
+
+ if (length > net::i2p_address::buffer_size())
+ MONERO_THROW(net::error::invalid_i2p_address, "i2p address too long");
+
+ char host[net::i2p_address::buffer_size()] = {0};
+ a.load_binary(host, length);
+ host[sizeof(host) - 1] = 0;
+
+ if (std::strcmp(host, net::i2p_address::unknown_str()) == 0)
+ na = net::i2p_address::unknown();
+ else
+ na = MONERO_UNWRAP(net::i2p_address::make(host, port));
+ }
+
+ template <class Archive, class ver_type>
inline void serialize(Archive &a, net::tor_address& na, const ver_type ver)
{
boost::serialization::split_free(a, na, ver);
}
template <class Archive, class ver_type>
+ inline void serialize(Archive &a, net::i2p_address& na, const ver_type ver)
+ {
+ boost::serialization::split_free(a, na, ver);
+ }
+
+ template <class Archive, class ver_type>
inline void serialize(Archive &a, nodetool::peerlist_entry& pl, const ver_type ver)
{
a & pl.adr;
@@ -152,6 +199,13 @@ namespace boost
pl.pruning_seed = tools::make_pruning_seed(1+pl.adr.as<epee::net_utils::ipv4_network_address>().ip() % (1<<CRYPTONOTE_PRUNING_LOG_STRIPES), CRYPTONOTE_PRUNING_LOG_STRIPES);
}
#endif
+ if (ver < 2)
+ {
+ if (!typename Archive::is_saving())
+ pl.rpc_port = 0;
+ return;
+ }
+ a & pl.rpc_port;
}
template <class Archive, class ver_type>
diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h
index 6e5e45008..59c6099d5 100644
--- a/src/p2p/p2p_protocol_defs.h
+++ b/src/p2p/p2p_protocol_defs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2018, The Monero Project
+// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//
@@ -35,6 +35,7 @@
#include "serialization/keyvalue_serialization.h"
#include "net/net_utils_base.h"
#include "net/tor_address.h" // needed for serialization
+#include "net/i2p_address.h" // needed for serialization
#include "misc_language.h"
#include "string_tools.h"
#include "time_helper.h"
@@ -75,12 +76,14 @@ namespace nodetool
peerid_type id;
int64_t last_seen;
uint32_t pruning_seed;
+ uint16_t rpc_port;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(adr)
KV_SERIALIZE(id)
KV_SERIALIZE(last_seen)
KV_SERIALIZE_OPT(pruning_seed, (uint32_t)0)
+ KV_SERIALIZE_OPT(rpc_port, (uint16_t)0)
END_KV_SERIALIZE_MAP()
};
typedef peerlist_entry_base<epee::net_utils::network_address> peerlist_entry;
@@ -126,7 +129,11 @@ namespace nodetool
ss << std::setfill ('0') << std::setw (8) << std::hex << std::noshowbase;
for(const peerlist_entry& pe: pl)
{
- ss << pe.id << "\t" << pe.adr.str() << " \tpruning seed " << pe.pruning_seed << " \tlast_seen: " << epee::misc_utils::get_time_interval_string(now_time - pe.last_seen) << std::endl;
+ ss << pe.id << "\t" << pe.adr.str()
+ << " \trpc port " << (pe.rpc_port > 0 ? std::to_string(pe.rpc_port) : "-")
+ << " \tpruning seed " << pe.pruning_seed
+ << " \tlast_seen: " << epee::misc_utils::get_time_interval_string(now_time - pe.last_seen)
+ << std::endl;
}
return ss.str();
}
@@ -157,6 +164,7 @@ namespace nodetool
uuid network_id;
uint64_t local_time;
uint32_t my_port;
+ uint16_t rpc_port;
peerid_type peer_id;
BEGIN_KV_SERIALIZE_MAP()
@@ -164,6 +172,7 @@ namespace nodetool
KV_SERIALIZE(peer_id)
KV_SERIALIZE(local_time)
KV_SERIALIZE(my_port)
+ KV_SERIALIZE_OPT(rpc_port, (uint16_t)(0))
END_KV_SERIALIZE_MAP()
};
@@ -178,7 +187,7 @@ namespace nodetool
{
const static int ID = P2P_COMMANDS_POOL_BASE + 1;
- struct request
+ struct request_t
{
basic_node_data node_data;
t_playload_type payload_data;
@@ -188,8 +197,9 @@ namespace nodetool
KV_SERIALIZE(payload_data)
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<request_t> request;
- struct response
+ struct response_t
{
basic_node_data node_data;
t_playload_type payload_data;
@@ -209,7 +219,7 @@ namespace nodetool
{
const epee::net_utils::network_address &na = p.adr;
const epee::net_utils::ipv4_network_address &ipv4 = na.as<const epee::net_utils::ipv4_network_address>();
- local_peerlist.push_back(peerlist_entry_base<network_address_old>({{ipv4.ip(), ipv4.port()}, p.id, p.last_seen, p.pruning_seed}));
+ local_peerlist.push_back(peerlist_entry_base<network_address_old>({{ipv4.ip(), ipv4.port()}, p.id, p.last_seen, p.pruning_seed, p.rpc_port}));
}
else
MDEBUG("Not including in legacy peer list: " << p.adr.str());
@@ -224,12 +234,13 @@ namespace nodetool
std::vector<peerlist_entry_base<network_address_old>> local_peerlist;
epee::serialization::selector<is_store>::serialize_stl_container_pod_val_as_blob(local_peerlist, stg, hparent_section, "local_peerlist");
for (const auto &p: local_peerlist)
- ((response&)this_ref).local_peerlist_new.push_back(peerlist_entry({epee::net_utils::ipv4_network_address(p.adr.ip, p.adr.port), p.id, p.last_seen, p.pruning_seed}));
+ ((response&)this_ref).local_peerlist_new.push_back(peerlist_entry({epee::net_utils::ipv4_network_address(p.adr.ip, p.adr.port), p.id, p.last_seen, p.pruning_seed, p.rpc_port}));
}
}
END_KV_SERIALIZE_MAP()
};
- };
+ typedef epee::misc_utils::struct_init<response_t> response;
+ };
/************************************************************************/
@@ -240,15 +251,16 @@ namespace nodetool
{
const static int ID = P2P_COMMANDS_POOL_BASE + 2;
- struct request
+ struct request_t
{
t_playload_type payload_data;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(payload_data)
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<request_t> request;
- struct response
+ struct response_t
{
uint64_t local_time;
t_playload_type payload_data;
@@ -288,6 +300,7 @@ namespace nodetool
}
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<response_t> response;
};
/************************************************************************/
@@ -305,15 +318,16 @@ namespace nodetool
#define PING_OK_RESPONSE_STATUS_TEXT "OK"
- struct request
+ struct request_t
{
/*actually we don't need to send any real data*/
BEGIN_KV_SERIALIZE_MAP()
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<request_t> request;
- struct response
+ struct response_t
{
std::string status;
peerid_type peer_id;
@@ -323,6 +337,7 @@ namespace nodetool
KV_SERIALIZE(peer_id)
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<response_t> response;
};
@@ -349,15 +364,16 @@ namespace nodetool
{
const static int ID = P2P_COMMANDS_POOL_BASE + 4;
- struct request
+ struct request_t
{
proof_of_trust tr;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(tr)
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<request_t> request;
- struct response
+ struct response_t
{
std::string version;
std::string os_version;
@@ -373,6 +389,7 @@ namespace nodetool
KV_SERIALIZE(payload_info)
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<response_t> response;
};
@@ -383,15 +400,16 @@ namespace nodetool
{
const static int ID = P2P_COMMANDS_POOL_BASE + 5;
- struct request
+ struct request_t
{
proof_of_trust tr;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(tr)
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<request_t> request;
- struct response
+ struct response_t
{
std::vector<peerlist_entry> local_peerlist_white;
std::vector<peerlist_entry> local_peerlist_gray;
@@ -406,6 +424,7 @@ namespace nodetool
KV_SERIALIZE(local_time)
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<response_t> response;
};
/************************************************************************/
@@ -415,13 +434,14 @@ namespace nodetool
{
const static int ID = P2P_COMMANDS_POOL_BASE + 6;
- struct request
+ struct request_t
{
BEGIN_KV_SERIALIZE_MAP()
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<request_t> request;
- struct response
+ struct response_t
{
peerid_type my_id;
@@ -429,6 +449,7 @@ namespace nodetool
KV_SERIALIZE(my_id)
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<response_t> response;
};
/************************************************************************/
@@ -438,13 +459,14 @@ namespace nodetool
{
const static int ID = P2P_COMMANDS_POOL_BASE + 7;
- struct request
+ struct request_t
{
BEGIN_KV_SERIALIZE_MAP()
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<request_t> request;
- struct response
+ struct response_t
{
uint32_t support_flags;
@@ -452,6 +474,7 @@ namespace nodetool
KV_SERIALIZE(support_flags)
END_KV_SERIALIZE_MAP()
};
+ typedef epee::misc_utils::struct_init<response_t> response;
};
#endif
@@ -466,7 +489,3 @@ namespace nodetool
}
}
-
-BOOST_CLASS_VERSION(nodetool::peerlist_entry, 1)
-
-
diff --git a/src/p2p/stdafx.h b/src/p2p/stdafx.h
index b6ff37811..12a371702 100644
--- a/src/p2p/stdafx.h
+++ b/src/p2p/stdafx.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2018, The Monero Project
+// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//