#endif
using namespace std;
-using namespace boost;
static const int MAX_OUTBOUND_CONNECTIONS = 16;
CAddress addrSeenByPeer(CService("0.0.0.0", nPortZero), nLocalServices);
uint64_t nLocalHostNonce = 0;
boost::array<int, THREAD_MAX> vnThreadsRunning;
-static std::vector<SOCKET> vhListenSocket;
+static vector<SOCKET> vhListenSocket;
CAddrMan addrman;
vector<CNode*> vNodes;
set<CNetAddr> setservAddNodeAddresses;
CCriticalSection cs_setservAddNodeAddresses;
-vector<std::string> vAddedNodes;
+vector<string> vAddedNodes;
CCriticalSection cs_vAddedNodes;
static CSemaphore *semOutbound = NULL;
bool GetMyExternalIP(CNetAddr& ipRet)
{
struct sockaddr_in mapped;
- auto rnd = std::numeric_limits<uint64_t>::max();
+ auto rnd = numeric_limits<uint64_t>::max();
const char *srv;
int rc = GetExternalIPbySTUN(rnd, &mapped, &srv);
if(rc >= 0) {
return NULL;
}
-CNode* FindNode(std::string addrName)
+CNode* FindNode(string addrName)
{
LOCK(cs_vNodes);
for(CNode* pnode : vNodes)
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
printf("send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString().c_str(), addrYou.ToString().c_str(), addr.ToString().c_str());
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
- nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight);
+ nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, vector<string>()), nBestHeight);
}
-std::map<CNetAddr, int64_t> CNode::setBanned;
+map<CNetAddr, int64_t> CNode::setBanned;
CCriticalSection CNode::cs_setBanned;
void CNode::ClearBanned()
ThreadSocketHandler2(parg);
vnThreadsRunning[THREAD_SOCKETHANDLER]--;
}
- catch (std::exception& e) {
+ catch (exception& e) {
vnThreadsRunning[THREAD_SOCKETHANDLER]--;
PrintException(&e, "ThreadSocketHandler()");
} catch (...) {
ThreadDNSAddressSeed2(parg);
vnThreadsRunning[THREAD_DNSSEED]--;
}
- catch (std::exception& e) {
+ catch (exception& e) {
vnThreadsRunning[THREAD_DNSSEED]--;
PrintException(&e, "ThreadDNSAddressSeed()");
} catch (...) {
{
ThreadDumpAddress2(parg);
}
- catch (std::exception& e) {
+ catch (exception& e) {
PrintException(&e, "ThreadDumpAddress()");
}
printf("ThreadDumpAddress exited\n");
ThreadOpenConnections2(parg);
vnThreadsRunning[THREAD_OPENCONNECTIONS]--;
}
- catch (std::exception& e) {
+ catch (exception& e) {
vnThreadsRunning[THREAD_OPENCONNECTIONS]--;
PrintException(&e, "ThreadOpenConnections()");
} catch (...) {
// Add seed nodes if IRC isn't working
if (!IsLimited(NET_IPV4) && addrman.size()==0 && (GetTime() - nStart > 60) && !fTestNet)
{
- std::vector<uint32_t> vnSeed =
+ vector<uint32_t> vnSeed =
{
0x1c542868, 0x3859dd6f, 0x203c2e68, 0xf145a6bc, 0x638a545f, 0x325da346, 0x385da346, 0xfb2b8d5f,
0x52568c5f, 0xa979e65b, 0x8de6485d, 0x9f79e65b, 0x048a861f, 0x3388b55f, 0x6ff0b45e, 0x17e81f5f,
0xbe5ef3bc, 0x4689344d, 0xb223895e, 0xfcebeaad, 0xb7c0e92e, 0x993c1760, 0xe1e171b0, 0xb857e75b,
0xbf10002e, 0xb55b2cb2, 0xa90e2cb2, 0x13d6f15e, 0xf8be9225, 0x14ddf15e, 0x06e90305, 0x82472cb2,
};
- std::vector<CAddress> vAdd;
+ vector<CAddress> vAdd;
for (unsigned int i = 0; i < vnSeed.size(); i++)
{
// It'll only connect to one or two seed nodes because once it connects,
// Add Tor nodes if we have connection with onion router
if (mapArgs.count("-tor"))
{
- const std::vector<std::string> vstrTorSeed =
+ const vector<string> vstrTorSeed =
{
"seedp4knqnoei57u.onion",
"seedr3hhlepyi7fd.onion",
"eqon4usunavt76m7.onion",
"seedd3aldwpslzl3.onion"
};
- std::vector<CAddress> vAdd;
+ vector<CAddress> vAdd;
for (unsigned int i = 0; i < vstrTorSeed.size(); i++)
{
CAddress addr(CService(vstrTorSeed[i], GetDefaultPort()));
ThreadOpenAddedConnections2(parg);
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--;
}
- catch (std::exception& e) {
+ catch (exception& e) {
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--;
PrintException(&e, "ThreadOpenAddedConnections()");
} catch (...) {
ThreadMessageHandler2(parg);
vnThreadsRunning[THREAD_MESSAGEHANDLER]--;
}
- catch (std::exception& e) {
+ catch (exception& e) {
vnThreadsRunning[THREAD_MESSAGEHANDLER]--;
PrintException(&e, "ThreadMessageHandler()");
} catch (...) {
}
// Save original serialized message so newer versions are preserved
- mapRelay.insert(std::make_pair(inv, ss));
- vRelayExpiration.push_back(std::make_pair(GetTime() + 15 * 60, inv));
+ mapRelay.insert({inv, ss});
+ vRelayExpiration.push_back({GetTime() + 15 * 60, inv});
}
RelayInventory(inv);