diff options
author | luigi1111 <luigi1111w@gmail.com> | 2021-02-15 21:48:48 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2021-02-15 21:48:48 -0500 |
commit | 0bbaa9df81144a598f77ca53fb7fd9112fa38888 (patch) | |
tree | 8d16ddb2debf6943f32ecb4b7a3bab323436649c /src | |
parent | Merge pull request #7273 (diff) | |
parent | p2p: make REQUEST_SUPPORT_FLAGS optional, pass flags in node data (diff) | |
download | monero-0bbaa9df81144a598f77ca53fb7fd9112fa38888.tar.xz |
Merge pull request #7275
f815740 p2p: make REQUEST_SUPPORT_FLAGS optional, pass flags in node data (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r-- | src/p2p/net_node.inl | 21 | ||||
-rw-r--r-- | src/p2p/p2p_protocol_defs.h | 2 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 407f147f6..876b3876e 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -1165,6 +1165,7 @@ namespace nodetool pi = context.peer_id = rsp.node_data.peer_id; context.m_rpc_port = rsp.node_data.rpc_port; context.m_rpc_credits_per_hash = rsp.node_data.rpc_credits_per_hash; + context.support_flags = rsp.node_data.support_flags; const auto azone = context.m_remote_address.get_zone(); network_zone& zone = m_network_zones.at(azone); zone.m_peerlist.set_peer_just_seen(rsp.node_data.peer_id, context.m_remote_address, context.m_pruning_seed, context.m_rpc_port, context.m_rpc_credits_per_hash); @@ -1198,10 +1199,11 @@ namespace nodetool } else if (!just_take_peerlist) { - try_get_support_flags(context_, [](p2p_connection_context& flags_context, const uint32_t& support_flags) - { - flags_context.support_flags = support_flags; - }); + if (context_.support_flags == 0) + try_get_support_flags(context_, [](p2p_connection_context& flags_context, const uint32_t& support_flags) + { + flags_context.support_flags = support_flags; + }); } return hsh_result; @@ -2179,6 +2181,7 @@ namespace nodetool node_data.rpc_port = zone.m_can_pingback ? m_rpc_port : 0; node_data.rpc_credits_per_hash = zone.m_can_pingback ? m_rpc_credits_per_hash : 0; node_data.network_id = m_network_id; + node_data.support_flags = zone.m_config.m_support_flags; return true; } //----------------------------------------------------------------------------------- @@ -2549,6 +2552,7 @@ namespace nodetool context.m_in_timedsync = false; context.m_rpc_port = arg.node_data.rpc_port; context.m_rpc_credits_per_hash = arg.node_data.rpc_credits_per_hash; + context.support_flags = arg.node_data.support_flags; if(arg.node_data.my_port && zone.m_can_pingback) { @@ -2582,10 +2586,11 @@ namespace nodetool }); } - try_get_support_flags(context, [](p2p_connection_context& flags_context, const uint32_t& support_flags) - { - flags_context.support_flags = support_flags; - }); + if (context.support_flags == 0) + try_get_support_flags(context, [](p2p_connection_context& flags_context, const uint32_t& support_flags) + { + flags_context.support_flags = support_flags; + }); //fill response zone.m_peerlist.get_peerlist_head(rsp.local_peerlist_new, true); diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h index b439dc47e..12763d4ee 100644 --- a/src/p2p/p2p_protocol_defs.h +++ b/src/p2p/p2p_protocol_defs.h @@ -188,6 +188,7 @@ namespace nodetool uint16_t rpc_port; uint32_t rpc_credits_per_hash; peerid_type peer_id; + uint32_t support_flags; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE_VAL_POD_AS_BLOB(network_id) @@ -195,6 +196,7 @@ namespace nodetool KV_SERIALIZE(my_port) KV_SERIALIZE_OPT(rpc_port, (uint16_t)(0)) KV_SERIALIZE_OPT(rpc_credits_per_hash, (uint32_t)0) + KV_SERIALIZE_OPT(support_flags, (uint32_t)0) END_KV_SERIALIZE_MAP() }; |