From f347f7ebb302aec549d27422e83cda55a35bc62c Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Thu, 29 May 2014 12:33:17 +0200 Subject: [PATCH] rename fNoListen to fListen and move to net - better code readability and it belongs to net - this is a prerequisite for a pull to add -listen to the GUI --- src/init.cpp | 4 ++-- src/main.cpp | 4 ++-- src/net.cpp | 3 ++- src/net.h | 1 + src/util.cpp | 1 - src/util.h | 1 - 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 1737bb069..441743258 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -787,12 +787,12 @@ bool AppInit2(boost::thread_group& threadGroup) } // see Step 2: parameter interactions for more information about these - fNoListen = !GetBoolArg("-listen", true); + fListen = GetBoolArg("-listen", true); fDiscover = GetBoolArg("-discover", true); fNameLookup = GetBoolArg("-dns", true); bool fBound = false; - if (!fNoListen) { + if (fListen) { if (mapArgs.count("-bind")) { BOOST_FOREACH(std::string strBind, mapMultiArgs["-bind"]) { CService addrBind; diff --git a/src/main.cpp b/src/main.cpp index ed237a73c..409b2f63d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3822,7 +3822,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (!pfrom->fInbound) { // Advertise our address - if (!fNoListen && !IsInitialBlockDownload()) + if (fListen && !IsInitialBlockDownload()) { CAddress addr = GetLocalAddress(&pfrom->addr); if (addr.IsRoutable()) @@ -4611,7 +4611,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) pnode->setAddrKnown.clear(); // Rebroadcast our address - if (!fNoListen) + if (fListen) { CAddress addr = GetLocalAddress(&pnode->addr); if (addr.IsRoutable()) diff --git a/src/net.cpp b/src/net.cpp index f337447ff..ad1d105b6 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -46,6 +46,7 @@ bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOu // Global state variables // bool fDiscover = true; +bool fListen = true; uint64_t nLocalServices = NODE_NETWORK; CCriticalSection cs_mapLocalHost; map mapLocalHost; @@ -98,7 +99,7 @@ unsigned short GetListenPort() // find 'best' local address for a particular peer bool GetLocal(CService& addr, const CNetAddr *paddrPeer) { - if (fNoListen) + if (!fListen) return false; int nBestScore = -1; diff --git a/src/net.h b/src/net.h index 5862129fa..46ffade1f 100644 --- a/src/net.h +++ b/src/net.h @@ -100,6 +100,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer = NULL); extern bool fDiscover; +extern bool fListen; extern uint64_t nLocalServices; extern uint64_t nLocalHostNonce; extern CAddrMan addrman; diff --git a/src/util.cpp b/src/util.cpp index d1f76f6a5..d0e6bfee7 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -97,7 +97,6 @@ bool fDaemon = false; bool fServer = false; string strMiscWarning; bool fBloomFilters = true; -bool fNoListen = false; bool fLogTimestamps = false; volatile bool fReopenDebugLog = false; CClientUIInterface uiInterface; diff --git a/src/util.h b/src/util.h index 002946149..ffe346e5f 100644 --- a/src/util.h +++ b/src/util.h @@ -115,7 +115,6 @@ extern bool fPrintToDebugLog; extern bool fServer; extern std::string strMiscWarning; extern bool fBloomFilters; -extern bool fNoListen; extern bool fLogTimestamps; extern volatile bool fReopenDebugLog;