aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.inl
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2019-02-24 08:47:49 +0000
committerxiphon <xiphon@protonmail.com>2019-02-25 02:40:23 +0300
commit551104fbf1d2d82cad57d5ea240d1b7be2810ea1 (patch)
treef6ee718c60963bab82468c577f1705eef54b7768 /src/p2p/net_node.inl
parentMerge pull request #4988 (diff)
downloadmonero-551104fbf1d2d82cad57d5ea240d1b7be2810ea1.tar.xz
daemon: add --public-node mode, RPC port propagation over P2P
Diffstat (limited to 'src/p2p/net_node.inl')
-rw-r--r--src/p2p/net_node.inl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 471fdda0d..c12908832 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -864,7 +864,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 +931,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);
});
@@ -1094,6 +1095,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
@@ -1648,6 +1650,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 +2006,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 +2026,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 +2327,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));
}
}