aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortobtoht <tob@featherwallet.org>2025-08-21 16:27:33 +0000
committertobtoht <tob@featherwallet.org>2025-08-21 16:27:33 +0000
commitcc3b1cb29a1391af0579a69079a0955213f392c0 (patch)
treefbd0c251f9d8b4579a85d60c62327833a866a8db /src
parenteb39d64e40a9881c18c93db2bff32f721feda0d3 (diff)
parente23b759b37027b989d1eee81f91cae9d28109f2b (diff)
downloadmonzero-core-cc3b1cb29a1391af0579a69079a0955213f392c0.tar.gz
monzero-core-cc3b1cb29a1391af0579a69079a0955213f392c0.tar.xz
monzero-core-cc3b1cb29a1391af0579a69079a0955213f392c0.zip
Merge pull request #10047
e23b759 Skip ping connections in outgoing count (Lee *!* Clagett)
Diffstat (limited to 'src')
-rw-r--r--src/p2p/net_node.h4
-rw-r--r--src/p2p/net_node.inl6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h
index 5f471ad55..423e2607e 100644
--- a/src/p2p/net_node.h
+++ b/src/p2p/net_node.h
@@ -110,15 +110,17 @@ namespace nodetool
template<class base_type>
struct p2p_connection_context_t: base_type //t_payload_net_handler::connection_context //public net_utils::connection_context_base
{
- p2p_connection_context_t()
+ explicit p2p_connection_context_t(bool is_ping = false)
: peer_id(0),
support_flags(0),
+ is_ping(is_ping),
m_in_timedsync(false)
{}
peerid_type peer_id;
uint32_t support_flags;
bool m_in_timedsync;
+ bool is_ping;
std::set<epee::net_utils::network_address> sent_addresses;
};
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 51cf48cb4..6a68790fd 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -1062,7 +1062,7 @@ namespace nodetool
{
++number_of_in_peers;
}
- else
+ else if (!cntxt.is_ping)
{
++number_of_out_peers;
}
@@ -1973,7 +1973,7 @@ namespace nodetool
size_t count = 0;
zone.m_net_server.get_config_object().foreach_connection([&](const p2p_connection_context& cntxt)
{
- if(!cntxt.m_is_income)
+ if(!cntxt.m_is_income && !cntxt.is_ping)
++count;
return true;
});
@@ -2454,7 +2454,7 @@ namespace nodetool
return false;
}
return true;
- }, "0.0.0.0", m_ssl_support);
+ }, "0.0.0.0", m_ssl_support, p2p_connection_context{true /* is_ping */});
if(!r)
{
LOG_WARNING_CC(context, "Failed to call connect_async, network error.");