From 63058be55055cf2bff32a009fbeb2f0fbe7507dd Mon Sep 17 00:00:00 2001 From: svost Date: Tue, 7 Feb 2017 21:27:45 +0300 Subject: [PATCH] Rename fNoListen to fListen --- src/init.cpp | 6 +++--- src/irc.cpp | 6 +++--- src/main.cpp | 2 +- src/net.cpp | 5 +++-- src/net.h | 2 +- src/util.cpp | 1 - src/util.h | 1 - 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 25f90f2..e645b99 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -674,19 +674,19 @@ bool AppInit2() // see Step 2: parameter interactions for more information about these if (!IsLimited(NET_IPV4) || !IsLimited(NET_IPV6)) { - fNoListen = !GetBoolArg("-listen", true); + fListen = GetBoolArg("-listen", true); fDiscover = GetBoolArg("-discover", true); fNameLookup = GetBoolArg("-dns", true); } else { // Don't listen, discover addresses or search for nodes if IPv4 and IPv6 networking is disabled. - fNoListen = true; + fListen = false; fDiscover = fNameLookup = false; SoftSetBoolArg("-irc", false); SoftSetBoolArg("-dnsseed", false); } bool fBound = false; - if (!fNoListen) + if (fListen) { if (mapArgs.count("-bind")) { for(std::string strBind : mapMultiArgs["-bind"]) { diff --git a/src/irc.cpp b/src/irc.cpp index bc1cb31..6e2a854 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -210,7 +210,7 @@ void ThreadIRCSeed2(void* parg) return; // ... or if we won't make outbound connections and won't accept inbound ones. - if (mapArgs.count("-connect") && fNoListen) + if (mapArgs.count("-connect") && !fListen) return; // ... or if IRC is not enabled. @@ -258,7 +258,7 @@ void ThreadIRCSeed2(void* parg) string strMyName; // Don't use our IP as our nick if we're not listening // or if it keeps failing because the nick is already in use. - if (!fNoListen && GetLocal(addrLocal, &addrIPv4) && nNameRetry<3) + if (fListen && GetLocal(addrLocal, &addrIPv4) && nNameRetry<3) strMyName = EncodeAddress(GetLocalAddress(&addrConnect)); if (strMyName.empty()) strMyName = strprintf("x%" PRIu64 "", GetRand(1000000000)); @@ -294,7 +294,7 @@ void ThreadIRCSeed2(void* parg) { printf("GetIPFromIRC() returned %s\n", addrFromIRC.ToString().c_str()); // Don't use our IP as our nick if we're not listening - if (!fNoListen && addrFromIRC.IsRoutable()) + if (fListen && addrFromIRC.IsRoutable()) { // IRC lets you to re-nick AddLocal(addrFromIRC, LOCAL_IRC); diff --git a/src/main.cpp b/src/main.cpp index 25dd390..59a38a6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3604,7 +3604,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (!pfrom->fInbound) { // Advertise our address - if (!fNoListen && !IsInitialBlockDownload()) + if (fListen && !IsInitialBlockDownload()) { auto addr = GetLocalAddress(&pfrom->addr); if (addr.IsRoutable()) diff --git a/src/net.cpp b/src/net.cpp index 20e4c8f..4cbe70e 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -38,6 +38,7 @@ void ThreadDNSAddressSeed2(void* parg); // bool fClient = false; bool fDiscover = true; +bool fListen = true; uint64_t nLocalServices = (fClient ? 0 : NODE_NETWORK); CCriticalSection cs_mapLocalHost; map mapLocalHost; @@ -94,7 +95,7 @@ void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd) // find 'best' local address for a particular peer bool GetLocal(CService& addr, const CNetAddr *paddrPeer) { - if (fNoListen) + if (!fListen) return false; int nBestScore = -1; @@ -227,7 +228,7 @@ bool IsPeerAddrLocalGood(CNode *pnode) // pushes our own address to a peer void AdvertiseLocal(CNode *pnode) { - if (!fNoListen && pnode->fSuccessfullyConnected) + if (fListen && pnode->fSuccessfullyConnected) { auto addrLocal = GetLocalAddress(&pnode->addr); // If discovery is enabled, sometimes give our peer the address it diff --git a/src/net.h b/src/net.h index e38df98..8d1667f 100644 --- a/src/net.h +++ b/src/net.h @@ -116,7 +116,7 @@ enum threadId extern bool fClient; extern bool fDiscover; -extern bool fNoListen; +extern bool fListen; extern bool fDiscover; extern uint64_t nLocalServices; diff --git a/src/util.cpp b/src/util.cpp index 50caee2..a63ca2c 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -59,7 +59,6 @@ bool fServer = false; bool fCommandLine = false; string strMiscWarning; bool fTestNet = false; -bool fNoListen = false; bool fLogTimestamps = false; CMedianFilter vTimeOffsets(200,0); bool fReopenDebugLog = false; diff --git a/src/util.h b/src/util.h index 8ba9081..5e21222 100644 --- a/src/util.h +++ b/src/util.h @@ -151,7 +151,6 @@ extern bool fServer; extern bool fCommandLine; extern std::string strMiscWarning; extern bool fTestNet; -extern bool fNoListen; extern bool fLogTimestamps; extern bool fReopenDebugLog; -- 1.7.1