Skip to content

Commit 3bf06e9

Browse files
committed
Merge #9226: Remove fNetworkNode and pnodeLocalHost.
bdb922b Remove pnodeLocalHost. (Gregory Maxwell) 083f203 Remove fNetworkNode. (Gregory Maxwell)
2 parents 72ae6f8 + bdb922b commit 3bf06e9

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5242,8 +5242,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
52425242
{
52435243
pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION));
52445244

5245-
// Mark this node as currently connected, so we update its timestamp later.
5246-
if (pfrom->fNetworkNode) {
5245+
if (!pfrom->fInbound) {
5246+
// Mark this node as currently connected, so we update its timestamp later.
52475247
LOCK(cs_main);
52485248
State(pfrom->GetId())->fCurrentlyConnected = true;
52495249
}

src/net.cpp

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ bool fRelayTxes = true;
7474
CCriticalSection cs_mapLocalHost;
7575
std::map<CNetAddr, LocalServiceInfo> mapLocalHost;
7676
static bool vfLimited[NET_MAX] = {};
77-
static CNode* pnodeLocalHost = NULL;
7877
std::string strSubVersion;
7978

8079
limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ);
@@ -1067,8 +1066,7 @@ void CConnman::ThreadSocketHandler()
10671066
pnode->CloseSocketDisconnect();
10681067

10691068
// hold in disconnected pool until all refs are released
1070-
if (pnode->fNetworkNode || pnode->fInbound)
1071-
pnode->Release();
1069+
pnode->Release();
10721070
vNodesDisconnected.push_back(pnode);
10731071
}
10741072
}
@@ -1813,7 +1811,6 @@ bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
18131811
return false;
18141812
if (grantOutbound)
18151813
grantOutbound->MoveTo(pnode->grantOutbound);
1816-
pnode->fNetworkNode = true;
18171814
if (fOneShot)
18181815
pnode->fOneShot = true;
18191816
if (fFeeler)
@@ -2144,17 +2141,6 @@ bool CConnman::Start(boost::thread_group& threadGroup, CScheduler& scheduler, st
21442141
semOutbound = new CSemaphore(std::min((nMaxOutbound + nMaxFeeler), nMaxConnections));
21452142
}
21462143

2147-
if (pnodeLocalHost == NULL) {
2148-
CNetAddr local;
2149-
LookupHost("127.0.0.1", local, false);
2150-
2151-
NodeId id = GetNewNodeId();
2152-
uint64_t nonce = GetDeterministicRandomizer(RANDOMIZER_ID_LOCALHOSTNONCE).Write(id).Finalize();
2153-
2154-
pnodeLocalHost = new CNode(id, nLocalServices, GetBestHeight(), INVALID_SOCKET, CAddress(CService(local, 0), nLocalServices), 0, nonce);
2155-
GetNodeSignals().InitializeNode(pnodeLocalHost, *this);
2156-
}
2157-
21582144
//
21592145
// Start threads
21602146
//
@@ -2232,9 +2218,6 @@ void CConnman::Stop()
22322218
vhListenSocket.clear();
22332219
delete semOutbound;
22342220
semOutbound = NULL;
2235-
if(pnodeLocalHost)
2236-
DeleteNode(pnodeLocalHost);
2237-
pnodeLocalHost = NULL;
22382221
}
22392222

22402223
void CConnman::DeleteNode(CNode* pnode)
@@ -2536,7 +2519,6 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
25362519
fOneShot = false;
25372520
fClient = false; // set by version message
25382521
fFeeler = false;
2539-
fNetworkNode = false;
25402522
fSuccessfullyConnected = false;
25412523
fDisconnect = false;
25422524
nRefCount = 0;

src/net.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ class CNode
613613
bool fOneShot;
614614
bool fClient;
615615
const bool fInbound;
616-
bool fNetworkNode;
617616
bool fSuccessfullyConnected;
618617
std::atomic_bool fDisconnect;
619618
// We use fRelayTxes for two purposes -

0 commit comments

Comments
 (0)