Skip to content

Commit 57edc0b

Browse files
committed
Rename fAddnode to a more-descriptive "manual_connection"
1 parent 4440710 commit 57edc0b

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/net.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ void CNode::copyStats(CNodeStats &stats)
684684
X(cleanSubVer);
685685
}
686686
X(fInbound);
687-
X(fAddnode);
687+
X(m_manual_connection);
688688
X(nStartingHeight);
689689
{
690690
LOCK(cs_vSend);
@@ -1756,7 +1756,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
17561756
{
17571757
LOCK(cs_vNodes);
17581758
for (CNode* pnode : vNodes) {
1759-
if (!pnode->fInbound && !pnode->fAddnode) {
1759+
if (!pnode->fInbound && !pnode->m_manual_connection) {
17601760
// Netgroups for inbound and addnode peers are not excluded because our goal here
17611761
// is to not use multiple of our limited outbound slots on a single netgroup
17621762
// but inbound and addnode peers do not use our outbound slots. Inbound peers
@@ -1927,7 +1927,7 @@ void CConnman::ThreadOpenAddedConnections()
19271927
}
19281928

19291929
// if successful, this moves the passed grant to the constructed node
1930-
bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler, bool fAddnode)
1930+
bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler, bool manual_connection)
19311931
{
19321932
//
19331933
// Initiate outbound network connection
@@ -1956,8 +1956,8 @@ bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
19561956
pnode->fOneShot = true;
19571957
if (fFeeler)
19581958
pnode->fFeeler = true;
1959-
if (fAddnode)
1960-
pnode->fAddnode = true;
1959+
if (manual_connection)
1960+
pnode->m_manual_connection = true;
19611961

19621962
m_msgproc->InitializeNode(pnode);
19631963
{
@@ -2705,7 +2705,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
27052705
strSubVer = "";
27062706
fWhitelisted = false;
27072707
fOneShot = false;
2708-
fAddnode = false;
2708+
m_manual_connection = false;
27092709
fClient = false; // set by version message
27102710
fFeeler = false;
27112711
fSuccessfullyConnected = false;

src/net.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class CConnman
171171
void Interrupt();
172172
bool GetNetworkActive() const { return fNetworkActive; };
173173
void SetNetworkActive(bool active);
174-
bool OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound = nullptr, const char *strDest = nullptr, bool fOneShot = false, bool fFeeler = false, bool fAddnode = false);
174+
bool OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound = nullptr, const char *strDest = nullptr, bool fOneShot = false, bool fFeeler = false, bool manual_connection = false);
175175
bool CheckIncomingNonce(uint64_t nonce);
176176

177177
bool ForNode(NodeId id, std::function<bool(CNode* pnode)> func);
@@ -506,7 +506,7 @@ class CNodeStats
506506
int nVersion;
507507
std::string cleanSubVer;
508508
bool fInbound;
509-
bool fAddnode;
509+
bool m_manual_connection;
510510
int nStartingHeight;
511511
uint64_t nSendBytes;
512512
mapMsgCmdSize mapSendBytesPerMsgCmd;
@@ -615,7 +615,7 @@ class CNode
615615
bool fWhitelisted; // This peer can bypass DoS banning.
616616
bool fFeeler; // If true this node is being used as a short lived feeler.
617617
bool fOneShot;
618-
bool fAddnode;
618+
bool m_manual_connection;
619619
bool fClient;
620620
const bool fInbound;
621621
std::atomic_bool fSuccessfullyConnected;

src/net_processing.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
12321232
{
12331233
connman->SetServices(pfrom->addr, nServices);
12341234
}
1235-
if (!pfrom->fInbound && !pfrom->fFeeler && !pfrom->fAddnode && !HasAllDesirableServiceFlags(nServices))
1235+
if (!pfrom->fInbound && !pfrom->fFeeler && !pfrom->m_manual_connection && !HasAllDesirableServiceFlags(nServices))
12361236
{
12371237
LogPrint(BCLog::NET, "peer=%d does not offer the expected services (%08x offered, %08x expected); disconnecting\n", pfrom->GetId(), nServices, GetDesirableServiceFlags(nServices));
12381238
connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_NONSTANDARD,
@@ -2628,8 +2628,8 @@ static bool SendRejectsAndCheckIfBanned(CNode* pnode, CConnman* connman)
26282628
state.fShouldBan = false;
26292629
if (pnode->fWhitelisted)
26302630
LogPrintf("Warning: not punishing whitelisted peer %s!\n", pnode->addr.ToString());
2631-
else if (pnode->fAddnode)
2632-
LogPrintf("Warning: not punishing addnoded peer %s!\n", pnode->addr.ToString());
2631+
else if (pnode->m_manual_connection)
2632+
LogPrintf("Warning: not punishing manually-connected peer %s!\n", pnode->addr.ToString());
26332633
else {
26342634
pnode->fDisconnect = true;
26352635
if (pnode->addr.IsLocal())

src/rpc/net.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ UniValue getpeerinfo(const JSONRPCRequest& request)
9292
" \"version\": v, (numeric) The peer version, such as 7001\n"
9393
" \"subver\": \"/Satoshi:0.8.5/\", (string) The string version\n"
9494
" \"inbound\": true|false, (boolean) Inbound (true) or Outbound (false)\n"
95-
" \"addnode\": true|false, (boolean) Whether connection was due to addnode and is using an addnode slot\n"
95+
" \"addnode\": true|false, (boolean) Whether connection was due to addnode/-connect or if it was an automatic/inbound connection\n"
9696
" \"startingheight\": n, (numeric) The starting height (block) of the peer\n"
9797
" \"banscore\": n, (numeric) The ban score\n"
9898
" \"synced_headers\": n, (numeric) The last header we have in common with this peer\n"
@@ -156,7 +156,7 @@ UniValue getpeerinfo(const JSONRPCRequest& request)
156156
// their ver message.
157157
obj.push_back(Pair("subver", stats.cleanSubVer));
158158
obj.push_back(Pair("inbound", stats.fInbound));
159-
obj.push_back(Pair("addnode", stats.fAddnode));
159+
obj.push_back(Pair("addnode", stats.m_manual_connection));
160160
obj.push_back(Pair("startingheight", stats.nStartingHeight));
161161
if (fStateStats) {
162162
obj.push_back(Pair("banscore", statestats.nMisbehavior));

0 commit comments

Comments
 (0)