From 6853140e899841c78ef5f02a261eefeb835e9abf Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Sat, 19 Sep 2015 03:15:58 +0300 Subject: [PATCH] Define additional constants for zero and irc port number. --- src/irc.cpp | 5 +++-- src/net.cpp | 8 ++++---- src/net.h | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/irc.cpp b/src/irc.cpp index 7c00d50..b3201b1 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -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; diff --git a/src/net.cpp b/src/net.cpp index 15c0e7f..f289bd5 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -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 vnThreadsRunning; static std::vector 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(); diff --git a/src/net.h b/src/net.h index 9af8864..5a1698b 100644 --- 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); } -- 1.7.1