From: Gavin Andresen Date: Fri, 2 Sep 2011 16:25:25 +0000 (-0400) Subject: Stay connected to seed nodes; disconnecting causes problems if you are trying to... X-Git-Tag: v0.4.0-unstable~227^2~28 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=b53e277ba12e011287d3b15823b64c303ab66243 Stay connected to seed nodes; disconnecting causes problems if you are trying to make the initial blockchain download. --- diff --git a/src/net.cpp b/src/net.cpp index 952102e..5fca17a 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1349,7 +1349,6 @@ void ThreadOpenConnections2(void* parg) CRITICAL_BLOCK(cs_mapAddresses) { // Add seed nodes if IRC isn't working - static bool fSeedUsed; bool fTOR = (fUseProxy && addrProxy.port == htons(9050)); if (mapAddresses.empty() && (GetTime() - nStart > 60 || fTOR) && !fTestNet) { @@ -1365,35 +1364,6 @@ void ThreadOpenConnections2(void* parg) addr.nTime = GetTime()-GetRand(nOneWeek)-nOneWeek; AddAddress(addr); } - fSeedUsed = true; - } - - if (fSeedUsed && mapAddresses.size() > ARRAYLEN(pnSeed) + 100) - { - // Disconnect seed nodes - set setSeed(pnSeed, pnSeed + ARRAYLEN(pnSeed)); - static int64 nSeedDisconnected; - if (nSeedDisconnected == 0) - { - nSeedDisconnected = GetTime(); - CRITICAL_BLOCK(cs_vNodes) - BOOST_FOREACH(CNode* pnode, vNodes) - if (setSeed.count(pnode->addr.ip)) - pnode->fDisconnect = true; - } - - // Keep setting timestamps to 0 so they won't reconnect - if (GetTime() - nSeedDisconnected < 60 * 60) - { - BOOST_FOREACH(PAIRTYPE(const vector, CAddress)& item, mapAddresses) - { - if (setSeed.count(item.second.ip) && item.second.nTime != 0) - { - item.second.nTime = 0; - CAddrDB().WriteAddress(item.second); - } - } - } } }