tree checksum vpatch file split hunks
all signers: mircea_popescu trinque mod6 asciilifeform ben_vulpes
antecedents: asciilifeform_aggressive_pushgetblocks asciilifeform_aggressive_pushgetblocks
press order:
patch:
(13 . 8)(13 . 6)
5 using namespace std;
6 using namespace boost;
7
8 static const int MAX_OUTBOUND_CONNECTIONS = 8;
9
10 void ThreadMessageHandler2(void* parg);
11 void ThreadSocketHandler2(void* parg);
12 void ThreadOpenConnections2(void* parg);
(741 . 7)(739 . 7)
14 if (WSAGetLastError() != WSAEWOULDBLOCK)
15 printf("socket error accept failed: %d\n", WSAGetLastError());
16 }
17 else if (nInbound >= GetArg("-maxconnections", 125) - MAX_OUTBOUND_CONNECTIONS)
18 else if (nInbound >= GetArg("-maxconnections", 125))
19 {
20 closesocket(hSocket);
21 }
(830 . 6)(828 . 9)
23 //
24 if (pnode->hSocket == INVALID_SOCKET)
25 continue;
26 if ((nTimeBestReceived - GetTime()) > 20 * 60) {
27 pnode->PushGetBlocks(pindexBest, uint256(0));
28 }
29 if (FD_ISSET(pnode->hSocket, &fdsetSend))
30 {
31 TRY_CRITICAL_BLOCK(pnode->cs_vSend)
(974 . 8)(975 . 7)
33 BOOST_FOREACH(CNode* pnode, vNodes)
34 if (!pnode->fInbound)
35 nOutbound++;
36 int nMaxOutboundConnections = MAX_OUTBOUND_CONNECTIONS;
37 nMaxOutboundConnections = min(nMaxOutboundConnections, (int)GetArg("-maxconnections", 125));
38 int nMaxOutboundConnections = GetArg("-maxconnections", 125);
39 if (nOutbound < nMaxOutboundConnections)
40 break;
41 vnThreadsRunning[1]--;
(991 . 13)(991 . 6)
43 CAddress addrConnect;
44 int64 nBest = INT64_MIN;
45
46 // Only connect to one address per a.b.?.? range.
47 // Do this here so we don't have to critsect vNodes inside mapAddresses critsect.
48 set<unsigned int> setConnected;
49 CRITICAL_BLOCK(cs_vNodes)
50 BOOST_FOREACH(CNode* pnode, vNodes)
51 setConnected.insert(pnode->addr.ip & 0x0000ffff);
52
53 int64 nANow = GetAdjustedTime();
54
55 CRITICAL_BLOCK(cs_mapAddresses)
(1005 . 7)(998 . 7)
57 BOOST_FOREACH(const PAIRTYPE(vector<unsigned char>, CAddress)& item, mapAddresses)
58 {
59 const CAddress& addr = item.second;
60 if (!addr.IsIPv4() || !addr.IsValid() || setConnected.count(addr.ip & 0x0000ffff))
61 if (!addr.IsIPv4() || !addr.IsValid())
62 continue;
63 int64 nSinceLastSeen = nANow - addr.nTime;
64 int64 nSinceLastTry = nANow - addr.nLastTry;