Browse Source

0.9.33 fix serious connectivity problem: not trying to connect to >=0.9.30 peers with random ports.

miguelfreitas v0.9.33
Miguel Freitas 9 years ago
parent
commit
2cb7027b0e
  1. 20
      src/addrman.cpp
  2. 2
      src/clientversion.h
  3. 5
      src/net.cpp

20
src/addrman.cpp

@ -319,6 +319,26 @@ bool CAddrMan::Add_(const CAddress &addr, const CNetAddr& source, int64 nTimePen @@ -319,6 +319,26 @@ bool CAddrMan::Add_(const CAddress &addr, const CNetAddr& source, int64 nTimePen
int nId;
CAddrInfo *pinfo = Find(addr, &nId);
// port changed to random with twisterd >= 0.9.30
// we must replace old port info with the newer one
if( pinfo && pinfo->GetPort() != addr.GetPort() &&
pinfo->GetPort() == Params().GetDefaultPort() ) {
// remove the entry from all new buckets
for (std::vector<std::set<int> >::iterator it = vvNew.begin(); it != vvNew.end(); it++)
{
if ((*it).erase(nId))
pinfo->nRefCount--;
}
if (pinfo->nRefCount == 0)
{
SwapRandom(pinfo->nRandomPos, vRandom.size()-1);
vRandom.pop_back();
mapAddr.erase(*pinfo);
mapInfo.erase(nId);
pinfo = NULL;
}
}
if (pinfo)
{
// periodically update nTime

2
src/clientversion.h

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 9
#define CLIENT_VERSION_REVISION 32
#define CLIENT_VERSION_REVISION 33
#define CLIENT_VERSION_BUILD 0
// Set to true for release, false for prerelease or test build

5
src/net.cpp

@ -1244,6 +1244,7 @@ void _ThreadDNSAddressSeed(const char *strDNS) @@ -1244,6 +1244,7 @@ void _ThreadDNSAddressSeed(const char *strDNS)
int port = (ipPort.GetByte(1) << 8) + ipPort.GetByte(0);
int nOneDay = 24*3600;
CAddress addr = CAddress(CService(ip, port));
//printf("DNS seed nonstd: %s:%d\n", ip.ToStringIP().c_str(), port);
addr.nTime = GetTime() - 3*nOneDay - GetRand(4*nOneDay); // use a random age between 3 and 7 days old
vAdd.push_back(addr);
found++;
@ -1400,10 +1401,6 @@ void ThreadOpenConnections() @@ -1400,10 +1401,6 @@ void ThreadOpenConnections()
if (nANow - addr.nLastTry < 600 && nTries < 30)
continue;
// do not allow non-default ports, unless after 50 invalid addresses selected already
if (addr.GetPort() != Params().GetDefaultPort() && nTries < 50)
continue;
addrConnect = addr;
break;
}

Loading…
Cancel
Save