aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorAmiti Uttarwar <amiti@uttarwar.org>2020-07-20 14:24:48 -0700
committerAmiti Uttarwar <amiti@uttarwar.org>2020-08-07 17:18:16 -0700
commit2f2e13b6c2c8741ca9d825eaaef736ede484bc85 (patch)
tree225aa16a085f9bc34a6e96653bec35da60853270 /src/net.cpp
parent7f7b83deb2427599c129f4ff581d4d045461e459 (diff)
downloadbitcoin-2f2e13b6c2c8741ca9d825eaaef736ede484bc85.tar.xz
[net/refactor] Simplify multiple-connection checks
Extract logic that check multiple connection types into interface functions & structure as switch statements. This makes it very clear what touch points are for accessing `m_conn_type` & using the switch statements enables the compiler to warn if a new connection type is introduced but not handled for these cases.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 35daddbbe2..539ba9f40c 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1648,7 +1648,7 @@ void CConnman::ThreadDNSAddressSeed()
{
LOCK(cs_vNodes);
for (const CNode* pnode : vNodes) {
- nRelevant += pnode->fSuccessfullyConnected && !pnode->IsFeelerConn() && !pnode->IsAddrFetchConn() && !pnode->IsManualConn() && !pnode->IsInboundConn();
+ if (pnode->fSuccessfullyConnected && pnode->IsOutboundOrBlockRelayConn()) ++nRelevant;
}
}
if (nRelevant >= 2) {
@@ -1758,7 +1758,7 @@ int CConnman::GetExtraOutboundCount()
{
LOCK(cs_vNodes);
for (const CNode* pnode : vNodes) {
- if (!pnode->IsInboundConn() && !pnode->IsManualConn() && !pnode->IsFeelerConn() && !pnode->fDisconnect && !pnode->IsAddrFetchConn() && pnode->fSuccessfullyConnected) {
+ if (pnode->fSuccessfullyConnected && !pnode->fDisconnect && pnode->IsOutboundOrBlockRelayConn()) {
++nOutbound;
}
}