X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fnet.cpp;h=c69e83c0abc5e8403c215a125a0bf2f00f94f475;hp=756e5cb5f3a9b1b3e89c0ac22abd08937a7faf8e;hb=86ca35296e3e65c9a769a946f90a59b273063d9c;hpb=3bdc0abd5d7e262151c62426cb3006433fb21ffc diff --git a/src/net.cpp b/src/net.cpp index 756e5cb..c69e83c 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); @@ -570,10 +570,9 @@ void CNode::copyStats(CNodeStats &stats) } #undef X - - - - +void Release(CNode* node) { + node->Release(); +} @@ -606,7 +605,7 @@ void ThreadSocketHandler2(void* parg) { printf("ThreadSocketHandler started\n"); size_t nPrevNodeCount = 0; - while (true) + for ( ; ; ) { // // Disconnect nodes @@ -925,8 +924,7 @@ void ThreadSocketHandler2(void* parg) } { LOCK(cs_vNodes); - BOOST_FOREACH(CNode* pnode, vNodesCopy) - pnode->Release(); + for_each(vNodesCopy.begin(), vNodesCopy.end(), Release); } Sleep(10); @@ -1154,7 +1152,7 @@ void ThreadOpenConnections2(void* parg) // Initiate network connections int64_t nStart = GetTime(); - while (true) + for ( ; ; ) { ProcessOneShot(); @@ -1225,7 +1223,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); @@ -1507,8 +1505,7 @@ void ThreadMessageHandler2(void* parg) { LOCK(cs_vNodes); - BOOST_FOREACH(CNode* pnode, vNodesCopy) - pnode->Release(); + for_each(vNodesCopy.begin(), vNodesCopy.end(), Release); } // Wait and allow messages to bunch up. @@ -1760,7 +1757,7 @@ bool StopNode() if (semOutbound) for (int i=0; ipost(); - do + for ( ; ; ) { int nThreadsRunning = 0; for (int n = 0; n < THREAD_MAX; n++) @@ -1770,7 +1767,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");