mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-09-13 14:52:14 +00:00
0.9.33 fix serious connectivity problem: not trying to connect to >=0.9.30 peers with random ports.
This commit is contained in:
parent
7d31de981c
commit
2cb7027b0e
@ -319,6 +319,26 @@ bool CAddrMan::Add_(const CAddress &addr, const CNetAddr& source, int64 nTimePen
|
|||||||
int nId;
|
int nId;
|
||||||
CAddrInfo *pinfo = Find(addr, &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)
|
if (pinfo)
|
||||||
{
|
{
|
||||||
// periodically update nTime
|
// periodically update nTime
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
|
// 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_MAJOR 0
|
||||||
#define CLIENT_VERSION_MINOR 9
|
#define CLIENT_VERSION_MINOR 9
|
||||||
#define CLIENT_VERSION_REVISION 32
|
#define CLIENT_VERSION_REVISION 33
|
||||||
#define CLIENT_VERSION_BUILD 0
|
#define CLIENT_VERSION_BUILD 0
|
||||||
|
|
||||||
// Set to true for release, false for prerelease or test build
|
// Set to true for release, false for prerelease or test build
|
||||||
|
@ -1244,6 +1244,7 @@ void _ThreadDNSAddressSeed(const char *strDNS)
|
|||||||
int port = (ipPort.GetByte(1) << 8) + ipPort.GetByte(0);
|
int port = (ipPort.GetByte(1) << 8) + ipPort.GetByte(0);
|
||||||
int nOneDay = 24*3600;
|
int nOneDay = 24*3600;
|
||||||
CAddress addr = CAddress(CService(ip, port));
|
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
|
addr.nTime = GetTime() - 3*nOneDay - GetRand(4*nOneDay); // use a random age between 3 and 7 days old
|
||||||
vAdd.push_back(addr);
|
vAdd.push_back(addr);
|
||||||
found++;
|
found++;
|
||||||
@ -1400,10 +1401,6 @@ void ThreadOpenConnections()
|
|||||||
if (nANow - addr.nLastTry < 600 && nTries < 30)
|
if (nANow - addr.nLastTry < 600 && nTries < 30)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// do not allow non-default ports, unless after 50 invalid addresses selected already
|
|
||||||
if (addr.GetPort() != Params().GetDefaultPort() && nTries < 50)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
addrConnect = addr;
|
addrConnect = addr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user