From 083f20369878196785151e038e5f5126fed74021 Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Sun, 27 Nov 2016 02:47:22 +0000 Subject: Remove fNetworkNode. Matt pointed out to me that this appeared to be doing nothing (except involving itself in data races). --- src/main.cpp | 4 ++-- src/net.cpp | 5 +---- src/net.h | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6bb81fab24..4b6872146c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5242,8 +5242,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, { pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); - // Mark this node as currently connected, so we update its timestamp later. - if (pfrom->fNetworkNode) { + if (!pfrom->fInbound) { + // Mark this node as currently connected, so we update its timestamp later. LOCK(cs_main); State(pfrom->GetId())->fCurrentlyConnected = true; } diff --git a/src/net.cpp b/src/net.cpp index ce87150ae3..08115a3518 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1067,8 +1067,7 @@ void CConnman::ThreadSocketHandler() pnode->CloseSocketDisconnect(); // hold in disconnected pool until all refs are released - if (pnode->fNetworkNode || pnode->fInbound) - pnode->Release(); + pnode->Release(); vNodesDisconnected.push_back(pnode); } } @@ -1808,7 +1807,6 @@ bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai return false; if (grantOutbound) grantOutbound->MoveTo(pnode->grantOutbound); - pnode->fNetworkNode = true; if (fOneShot) pnode->fOneShot = true; if (fFeeler) @@ -2531,7 +2529,6 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn fOneShot = false; fClient = false; // set by version message fFeeler = false; - fNetworkNode = false; fSuccessfullyConnected = false; fDisconnect = false; nRefCount = 0; diff --git a/src/net.h b/src/net.h index a4a9fb676a..ebea488a4d 100644 --- a/src/net.h +++ b/src/net.h @@ -613,7 +613,6 @@ public: bool fOneShot; bool fClient; const bool fInbound; - bool fNetworkNode; bool fSuccessfullyConnected; bool fDisconnect; // We use fRelayTxes for two purposes - -- cgit v1.2.3 From bdb922b34c9a477c4ebf358653f6bcfb9bee48ce Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Sun, 27 Nov 2016 04:19:37 +0000 Subject: Remove pnodeLocalHost. Mostly a legacy of the long removed pub/sub system. --- src/net.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 08115a3518..c9317c3025 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -74,7 +74,6 @@ bool fRelayTxes = true; CCriticalSection cs_mapLocalHost; std::map mapLocalHost; static bool vfLimited[NET_MAX] = {}; -static CNode* pnodeLocalHost = NULL; std::string strSubVersion; limitedmap mapAlreadyAskedFor(MAX_INV_SZ); @@ -2137,17 +2136,6 @@ bool CConnman::Start(boost::thread_group& threadGroup, CScheduler& scheduler, st semOutbound = new CSemaphore(std::min((nMaxOutbound + nMaxFeeler), nMaxConnections)); } - if (pnodeLocalHost == NULL) { - CNetAddr local; - LookupHost("127.0.0.1", local, false); - - NodeId id = GetNewNodeId(); - uint64_t nonce = GetDeterministicRandomizer(RANDOMIZER_ID_LOCALHOSTNONCE).Write(id).Finalize(); - - pnodeLocalHost = new CNode(id, nLocalServices, GetBestHeight(), INVALID_SOCKET, CAddress(CService(local, 0), nLocalServices), 0, nonce); - GetNodeSignals().InitializeNode(pnodeLocalHost, *this); - } - // // Start threads // @@ -2225,9 +2213,6 @@ void CConnman::Stop() vhListenSocket.clear(); delete semOutbound; semOutbound = NULL; - if(pnodeLocalHost) - DeleteNode(pnodeLocalHost); - pnodeLocalHost = NULL; } void CConnman::DeleteNode(CNode* pnode) -- cgit v1.2.3