Define additional constants for zero and irc port number.
authorCryptoManiac <balthazar@yandex.ru>
Sat, 19 Sep 2015 00:15:58 +0000 (03:15 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Sat, 19 Sep 2015 00:15:58 +0000 (03:15 +0300)
src/irc.cpp
src/net.cpp
src/net.h

index 7c00d50..b3201b1 100644 (file)
@@ -228,9 +228,10 @@ void ThreadIRCSeed2(void* parg)
 
     while (!fShutdown)
     {
-        CService addrConnect("92.243.23.21", (uint16_t)6667); // irc.lfnet.org
+        const uint16_t nIrcPort = 6667;
+        CService addrConnect("92.243.23.21", nIrcPort); // irc.lfnet.org
 
-        CService addrIRC("irc.lfnet.org", (uint16_t)6667, true);
+        CService addrIRC("irc.lfnet.org", nIrcPort, true);
         if (addrIRC.IsValid())
             addrConnect = addrIRC;
 
index 15c0e7f..f289bd5 100644 (file)
@@ -64,7 +64,7 @@ static bool vfReachable[NET_MAX] = {};
 static bool vfLimited[NET_MAX] = {};
 static CNode* pnodeLocalHost = NULL;
 static CNode* pnodeSync = NULL;
-CAddress addrSeenByPeer(CService("0.0.0.0", (uint16_t)0), nLocalServices);
+CAddress addrSeenByPeer(CService("0.0.0.0", nPortZero), nLocalServices);
 uint64_t nLocalHostNonce = 0;
 boost::array<int, THREAD_MAX> vnThreadsRunning;
 static std::vector<SOCKET> vhListenSocket;
@@ -138,7 +138,7 @@ bool GetLocal(CService& addr, const CNetAddr *paddrPeer)
 // get best local address for a particular peer as a CAddress
 CAddress GetLocalAddress(const CNetAddr *paddrPeer)
 {
-    CAddress ret(CService("0.0.0.0", (uint16_t)0), 0);
+    CAddress ret(CService("0.0.0.0", nPortZero), 0);
     CService addr;
     if (GetLocal(addr, paddrPeer))
     {
@@ -497,7 +497,7 @@ void CNode::PushVersion()
     }
 
     if (!fHidden) {
-        addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",(uint16_t)0)));
+        addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0", nPortZero)));
         addrMe = GetLocalAddress(&addr);
     }
 
@@ -1898,7 +1898,7 @@ void StartNode(void* parg)
     }
 
     if (pnodeLocalHost == NULL)
-        pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress(CService("127.0.0.1", (uint16_t)0), nLocalServices));
+        pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress(CService("127.0.0.1", nPortZero), nLocalServices));
 
     Discover();
 
index 9af8864..5a1698b 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -29,6 +29,7 @@ class CBlockIndex;
 extern int nBestHeight;
 
 const uint16_t nSocksDefault = 9050;
+const uint16_t nPortZero = 0;
 
 
 inline uint64_t ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }