Test-before-evict in addrman
From BTC Core https://github.com/bitcoin/bitcoin/pull/9037/ with modifications to support our asmap. This has a small part of code commented out that depends feeler connection code.
This commit is contained in:
18
src/net.cpp
18
src/net.cpp
@@ -1434,6 +1434,7 @@ void ThreadOpenConnections()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Initiate network connections
|
||||
int64_t nStart = GetTime();
|
||||
while (true)
|
||||
@@ -1476,12 +1477,19 @@ void ThreadOpenConnections()
|
||||
}
|
||||
}
|
||||
|
||||
int64_t nANow = GetTime();
|
||||
addrman.ResolveCollisions();
|
||||
|
||||
int nTries = 0;
|
||||
while (true)
|
||||
{
|
||||
CAddrInfo addr = addrman.Select();
|
||||
int64_t nANow = GetTime();
|
||||
int nTries = 0;
|
||||
while (true) {
|
||||
CAddrInfo addr = addrman.SelectTriedCollision();
|
||||
|
||||
// SelectTriedCollision returns an invalid address if it is empty.
|
||||
/* TODO: Uncomment when merged with feeler connections
|
||||
if (!fFeeler || !addr.IsValid()) {
|
||||
addr = addrman.Select(fFeeler);
|
||||
}
|
||||
*/
|
||||
|
||||
// if we selected an invalid address, restart
|
||||
if (!addr.IsValid() || setConnected.count(addr.GetGroup(addrman.m_asmap)) || IsLocal(addr))
|
||||
|
||||
Reference in New Issue
Block a user