X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fnet.cpp;h=9d3b9983add1f6719b561a527e4abfd37683932d;hb=32b53bb54ee7591fd47dd1ee24e05b73337f40b5;hp=d872c7c4943e72a3d4f973cc8529fd8b21b6d8b9;hpb=76dd5491e364e8e7e4694a1a343101412450b419;p=novacoin.git diff --git a/src/net.cpp b/src/net.cpp index d872c7c..9d3b998 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -143,7 +143,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer) bool RecvLine(SOCKET hSocket, string& strLine) { strLine = ""; - while (true) + for ( ; ; ) { char c; int nBytes = recv(hSocket, &c, 1, 0); @@ -606,7 +606,7 @@ void ThreadSocketHandler2(void* parg) { printf("ThreadSocketHandler started\n"); size_t nPrevNodeCount = 0; - while (true) + for ( ; ; ) { // // Disconnect nodes @@ -1154,7 +1154,7 @@ void ThreadOpenConnections2(void* parg) // Initiate network connections int64_t nStart = GetTime(); - while (true) + for ( ; ; ) { ProcessOneShot(); @@ -1181,7 +1181,6 @@ void ThreadOpenConnections2(void* parg) // it'll get a pile of addresses with newer timestamps. // Seed nodes are given a random 'last seen time' of between one and two // weeks ago. - const int64_t nOneWeek = 7*24*60*60; struct in_addr ip; memcpy(&ip, &pnSeed[i], sizeof(ip)); CAddress addr(CService(ip, GetDefaultPort())); @@ -1197,7 +1196,6 @@ void ThreadOpenConnections2(void* parg) std::vector vAdd; for (unsigned int i = 0; i < ARRAYLEN(pchTorSeed); i++) { - const int64_t nOneWeek = 7*24*60*60; CAddress addr(CService(pchTorSeed[i], GetDefaultPort())); addr.nTime = GetTime()-GetRand(nOneWeek)-nOneWeek; vAdd.push_back(addr); @@ -1227,7 +1225,7 @@ void ThreadOpenConnections2(void* parg) int64_t nANow = GetAdjustedTime(); int nTries = 0; - while (true) + for ( ; ; ) { // use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections) CAddress addr = addrman.Select(10 + min(nOutbound,8)*10); @@ -1762,7 +1760,7 @@ bool StopNode() if (semOutbound) for (int i=0; ipost(); - do + for ( ; ; ) { int nThreadsRunning = 0; for (int n = 0; n < THREAD_MAX; n++) @@ -1772,7 +1770,7 @@ bool StopNode() if (GetTime() - nStart > 20) break; Sleep(20); - } while(true); + }; if (vnThreadsRunning[THREAD_SOCKETHANDLER] > 0) printf("ThreadSocketHandler still running\n"); if (vnThreadsRunning[THREAD_OPENCONNECTIONS] > 0) printf("ThreadOpenConnections still running\n"); if (vnThreadsRunning[THREAD_MESSAGEHANDLER] > 0) printf("ThreadMessageHandler still running\n");