Rename fNoListen to fListen
authorsvost <ya.nowa@yandex.ru>
Tue, 7 Feb 2017 18:27:45 +0000 (21:27 +0300)
committersvost <ya.nowa@yandex.ru>
Tue, 7 Feb 2017 18:27:45 +0000 (21:27 +0300)
src/init.cpp
src/irc.cpp
src/main.cpp
src/net.cpp
src/net.h
src/util.cpp
src/util.h

index 25f90f2..e645b99 100644 (file)
@@ -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"]) {
index bc1cb31..6e2a854 100644 (file)
@@ -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);
index 25dd390..59a38a6 100644 (file)
@@ -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())
index 20e4c8f..4cbe70e 100644 (file)
@@ -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<CNetAddr, LocalServiceInfo> 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
index e38df98..8d1667f 100644 (file)
--- 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;
index 50caee2..a63ca2c 100644 (file)
@@ -59,7 +59,6 @@ bool fServer = false;
 bool fCommandLine = false;
 string strMiscWarning;
 bool fTestNet = false;
-bool fNoListen = false;
 bool fLogTimestamps = false;
 CMedianFilter<int64_t> vTimeOffsets(200,0);
 bool fReopenDebugLog = false;
index 8ba9081..5e21222 100644 (file)
@@ -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;