|
|
@ -107,7 +107,7 @@ boost::condition_variable messageHandlerCondition; |
|
|
|
static CNodeSignals g_signals; |
|
|
|
static CNodeSignals g_signals; |
|
|
|
CNodeSignals& GetNodeSignals() { return g_signals; } |
|
|
|
CNodeSignals& GetNodeSignals() { return g_signals; } |
|
|
|
|
|
|
|
|
|
|
|
void AddOneShot(string strDest) |
|
|
|
void AddOneShot(const std::string& strDest) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOCK(cs_vOneShots); |
|
|
|
LOCK(cs_vOneShots); |
|
|
|
vOneShots.push_back(strDest); |
|
|
|
vOneShots.push_back(strDest); |
|
|
@ -1124,7 +1124,7 @@ void ThreadDNSAddressSeed() |
|
|
|
vector<CAddress> vAdd; |
|
|
|
vector<CAddress> vAdd; |
|
|
|
if (LookupHost(seed.host.c_str(), vIPs)) |
|
|
|
if (LookupHost(seed.host.c_str(), vIPs)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BOOST_FOREACH(CNetAddr& ip, vIPs) |
|
|
|
BOOST_FOREACH(const CNetAddr& ip, vIPs) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int nOneDay = 24*3600; |
|
|
|
int nOneDay = 24*3600; |
|
|
|
CAddress addr = CAddress(CService(ip, Params().GetDefaultPort())); |
|
|
|
CAddress addr = CAddress(CService(ip, Params().GetDefaultPort())); |
|
|
@ -1188,7 +1188,7 @@ void ThreadOpenConnections() |
|
|
|
for (int64_t nLoop = 0;; nLoop++) |
|
|
|
for (int64_t nLoop = 0;; nLoop++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ProcessOneShot(); |
|
|
|
ProcessOneShot(); |
|
|
|
BOOST_FOREACH(string strAddr, mapMultiArgs["-connect"]) |
|
|
|
BOOST_FOREACH(const std::string& strAddr, mapMultiArgs["-connect"]) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CAddress addr; |
|
|
|
CAddress addr; |
|
|
|
OpenNetworkConnection(addr, NULL, strAddr.c_str()); |
|
|
|
OpenNetworkConnection(addr, NULL, strAddr.c_str()); |
|
|
@ -1291,10 +1291,10 @@ void ThreadOpenAddedConnections() |
|
|
|
list<string> lAddresses(0); |
|
|
|
list<string> lAddresses(0); |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOCK(cs_vAddedNodes); |
|
|
|
LOCK(cs_vAddedNodes); |
|
|
|
BOOST_FOREACH(string& strAddNode, vAddedNodes) |
|
|
|
BOOST_FOREACH(const std::string& strAddNode, vAddedNodes) |
|
|
|
lAddresses.push_back(strAddNode); |
|
|
|
lAddresses.push_back(strAddNode); |
|
|
|
} |
|
|
|
} |
|
|
|
BOOST_FOREACH(string& strAddNode, lAddresses) { |
|
|
|
BOOST_FOREACH(const std::string& strAddNode, lAddresses) { |
|
|
|
CAddress addr; |
|
|
|
CAddress addr; |
|
|
|
CSemaphoreGrant grant(*semOutbound); |
|
|
|
CSemaphoreGrant grant(*semOutbound); |
|
|
|
OpenNetworkConnection(addr, &grant, strAddNode.c_str()); |
|
|
|
OpenNetworkConnection(addr, &grant, strAddNode.c_str()); |
|
|
@ -1309,20 +1309,19 @@ void ThreadOpenAddedConnections() |
|
|
|
list<string> lAddresses(0); |
|
|
|
list<string> lAddresses(0); |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOCK(cs_vAddedNodes); |
|
|
|
LOCK(cs_vAddedNodes); |
|
|
|
BOOST_FOREACH(string& strAddNode, vAddedNodes) |
|
|
|
BOOST_FOREACH(const std::string& strAddNode, vAddedNodes) |
|
|
|
lAddresses.push_back(strAddNode); |
|
|
|
lAddresses.push_back(strAddNode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
list<vector<CService> > lservAddressesToAdd(0); |
|
|
|
list<vector<CService> > lservAddressesToAdd(0); |
|
|
|
BOOST_FOREACH(string& strAddNode, lAddresses) |
|
|
|
BOOST_FOREACH(const std::string& strAddNode, lAddresses) { |
|
|
|
{ |
|
|
|
|
|
|
|
vector<CService> vservNode(0); |
|
|
|
vector<CService> vservNode(0); |
|
|
|
if(Lookup(strAddNode.c_str(), vservNode, Params().GetDefaultPort(), fNameLookup, 0)) |
|
|
|
if(Lookup(strAddNode.c_str(), vservNode, Params().GetDefaultPort(), fNameLookup, 0)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
lservAddressesToAdd.push_back(vservNode); |
|
|
|
lservAddressesToAdd.push_back(vservNode); |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOCK(cs_setservAddNodeAddresses); |
|
|
|
LOCK(cs_setservAddNodeAddresses); |
|
|
|
BOOST_FOREACH(CService& serv, vservNode) |
|
|
|
BOOST_FOREACH(const CService& serv, vservNode) |
|
|
|
setservAddNodeAddresses.insert(serv); |
|
|
|
setservAddNodeAddresses.insert(serv); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1333,7 +1332,7 @@ void ThreadOpenAddedConnections() |
|
|
|
LOCK(cs_vNodes); |
|
|
|
LOCK(cs_vNodes); |
|
|
|
BOOST_FOREACH(CNode* pnode, vNodes) |
|
|
|
BOOST_FOREACH(CNode* pnode, vNodes) |
|
|
|
for (list<vector<CService> >::iterator it = lservAddressesToAdd.begin(); it != lservAddressesToAdd.end(); it++) |
|
|
|
for (list<vector<CService> >::iterator it = lservAddressesToAdd.begin(); it != lservAddressesToAdd.end(); it++) |
|
|
|
BOOST_FOREACH(CService& addrNode, *(it)) |
|
|
|
BOOST_FOREACH(const CService& addrNode, *(it)) |
|
|
|
if (pnode->addr == addrNode) |
|
|
|
if (pnode->addr == addrNode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
it = lservAddressesToAdd.erase(it); |
|
|
|
it = lservAddressesToAdd.erase(it); |
|
|
@ -1906,7 +1905,7 @@ bool CAddrDB::Read(CAddrMan& addr) |
|
|
|
unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); } |
|
|
|
unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); } |
|
|
|
unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); } |
|
|
|
unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); } |
|
|
|
|
|
|
|
|
|
|
|
CNode::CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn, bool fInboundIn) : |
|
|
|
CNode::CNode(SOCKET hSocketIn, const CAddress& addrIn, const std::string& addrNameIn, bool fInboundIn) : |
|
|
|
ssSend(SER_NETWORK, INIT_PROTO_VERSION), |
|
|
|
ssSend(SER_NETWORK, INIT_PROTO_VERSION), |
|
|
|
addrKnown(5000, 0.001, insecure_rand()), |
|
|
|
addrKnown(5000, 0.001, insecure_rand()), |
|
|
|
setInventoryKnown(SendBufferSize() / 1000) |
|
|
|
setInventoryKnown(SendBufferSize() / 1000) |
|
|
|