Page MenuHomePhabricator

D8711.diff
No OneTemporary

D8711.diff

diff --git a/src/chainparams.cpp b/src/chainparams.cpp
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -178,9 +178,10 @@
// Note that of those which support the service bits prefix, most only
// support a subset of possible options. This is fine at runtime as
- // we'll fall back to using them as a oneshot if they don't support the
- // service bits we want, but we should get them updated to support all
- // service bits wanted by any release ASAP to avoid it where possible.
+ // we'll fall back to using them as an addrfetch if they don't support
+ // the service bits we want, but we should get them updated to support
+ // all service bits wanted by any release ASAP to avoid it where
+ // possible.
// Bitcoin ABC seeder
vSeeds.emplace_back("seed.bitcoinabc.org");
// bitcoinforks seeders
diff --git a/src/net.h b/src/net.h
--- a/src/net.h
+++ b/src/net.h
@@ -231,7 +231,7 @@
void OpenNetworkConnection(const CAddress &addrConnect, bool fCountFailure,
CSemaphoreGrant *grantOutbound = nullptr,
const char *strDest = nullptr,
- bool fOneShot = false, bool fFeeler = false,
+ bool m_addr_fetch = false, bool fFeeler = false,
bool manual_connection = false,
bool block_relay_only = false);
bool CheckIncomingNonce(uint64_t nonce);
@@ -385,8 +385,8 @@
bool InitBinds(const std::vector<CService> &binds,
const std::vector<NetWhitebindPermissions> &whiteBinds);
void ThreadOpenAddedConnections();
- void AddOneShot(const std::string &strDest);
- void ProcessOneShot();
+ void AddAddrFetch(const std::string &strDest);
+ void ProcessAddrFetch();
void ThreadOpenConnections(std::vector<std::string> connect);
void ThreadMessageHandler();
void AcceptConnection(const ListenSocket &hListenSocket);
@@ -458,8 +458,8 @@
std::atomic<bool> fNetworkActive{true};
bool fAddressesInitialized{false};
CAddrMan addrman;
- std::deque<std::string> vOneShots GUARDED_BY(cs_vOneShots);
- RecursiveMutex cs_vOneShots;
+ std::deque<std::string> m_addr_fetches GUARDED_BY(m_addr_fetches_mutex);
+ RecursiveMutex m_addr_fetches_mutex;
std::vector<std::string> vAddedNodes GUARDED_BY(cs_vAddedNodes);
RecursiveMutex cs_vAddedNodes;
std::vector<CNode *> vNodes GUARDED_BY(cs_vNodes);
@@ -836,7 +836,7 @@
bool m_legacyWhitelisted{false};
// If true this node is being used as a short lived feeler.
bool fFeeler{false};
- bool fOneShot{false};
+ bool m_addr_fetch{false};
bool m_manual_connection{false};
// set by version message
bool fClient{false};
diff --git a/src/net.cpp b/src/net.cpp
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -111,9 +111,9 @@
std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(cs_mapLocalHost);
static bool vfLimited[NET_MAX] GUARDED_BY(cs_mapLocalHost) = {};
-void CConnman::AddOneShot(const std::string &strDest) {
- LOCK(cs_vOneShots);
- vOneShots.push_back(strDest);
+void CConnman::AddAddrFetch(const std::string &strDest) {
+ LOCK(m_addr_fetches_mutex);
+ m_addr_fetches.push_back(strDest);
}
unsigned short GetListenPort() {
@@ -1786,10 +1786,10 @@
{
LOCK(cs_vNodes);
for (const CNode *pnode : vNodes) {
- nRelevant += pnode->fSuccessfullyConnected &&
- !pnode->fFeeler && !pnode->fOneShot &&
- !pnode->m_manual_connection &&
- !pnode->fInbound;
+ nRelevant +=
+ pnode->fSuccessfullyConnected &&
+ !pnode->fFeeler && !pnode->m_addr_fetch &&
+ !pnode->m_manual_connection && !pnode->fInbound;
}
}
if (nRelevant >= 2) {
@@ -1825,7 +1825,7 @@
LogPrintf("Loading addresses from DNS seed %s\n", seed);
if (HaveNameProxy()) {
- AddOneShot(seed);
+ AddAddrFetch(seed);
} else {
std::vector<CNetAddr> vIPs;
std::vector<CAddress> vAdd;
@@ -1855,8 +1855,8 @@
} else {
// We now avoid directly using results from DNS Seeds which do
// not support service bit filtering, instead using them as a
- // oneshot to get nodes with our desired service bits.
- AddOneShot(seed);
+ // addrfetch to get nodes with our desired service bits.
+ AddAddrFetch(seed);
}
}
--seeds_right_now;
@@ -1874,15 +1874,15 @@
addrman.size(), GetTimeMillis() - nStart);
}
-void CConnman::ProcessOneShot() {
+void CConnman::ProcessAddrFetch() {
std::string strDest;
{
- LOCK(cs_vOneShots);
- if (vOneShots.empty()) {
+ LOCK(m_addr_fetches_mutex);
+ if (m_addr_fetches.empty()) {
return;
}
- strDest = vOneShots.front();
- vOneShots.pop_front();
+ strDest = m_addr_fetches.front();
+ m_addr_fetches.pop_front();
}
CAddress addr;
CSemaphoreGrant grant(*semOutbound, true);
@@ -1913,8 +1913,8 @@
LOCK(cs_vNodes);
for (const CNode *pnode : vNodes) {
if (!pnode->fInbound && !pnode->m_manual_connection &&
- !pnode->fFeeler && !pnode->fDisconnect && !pnode->fOneShot &&
- pnode->fSuccessfullyConnected) {
+ !pnode->fFeeler && !pnode->fDisconnect &&
+ !pnode->m_addr_fetch && pnode->fSuccessfullyConnected) {
++nOutbound;
}
}
@@ -1927,7 +1927,7 @@
// Connect to specific addresses
if (!connect.empty()) {
for (int64_t nLoop = 0;; nLoop++) {
- ProcessOneShot();
+ ProcessAddrFetch();
for (const std::string &strAddr : connect) {
CAddress addr(CService(), NODE_NONE);
OpenNetworkConnection(addr, false, nullptr, strAddr.c_str(),
@@ -1952,7 +1952,7 @@
int64_t nNextFeeler =
PoissonNextSend(nStart * 1000 * 1000, FEELER_INTERVAL);
while (!interruptNet) {
- ProcessOneShot();
+ ProcessAddrFetch();
if (!interruptNet.sleep_for(std::chrono::milliseconds(500))) {
return;
@@ -2223,7 +2223,7 @@
void CConnman::OpenNetworkConnection(const CAddress &addrConnect,
bool fCountFailure,
CSemaphoreGrant *grantOutbound,
- const char *pszDest, bool fOneShot,
+ const char *pszDest, bool m_addr_fetch,
bool fFeeler, bool manual_connection,
bool block_relay_only) {
//
@@ -2257,8 +2257,8 @@
if (grantOutbound) {
grantOutbound->MoveTo(pnode->grantOutbound);
}
- if (fOneShot) {
- pnode->fOneShot = true;
+ if (m_addr_fetch) {
+ pnode->m_addr_fetch = true;
}
if (fFeeler) {
pnode->fFeeler = true;
@@ -2554,7 +2554,7 @@
}
for (const auto &strDest : connOptions.vSeedNodes) {
- AddOneShot(strDest);
+ AddAddrFetch(strDest);
}
if (clientInterface) {
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -487,8 +487,8 @@
// Whether this node should be marked as a preferred download node.
state->fPreferredDownload =
- (!node.fInbound || node.HasPermission(PF_NOBAN)) && !node.fOneShot &&
- !node.fClient;
+ (!node.fInbound || node.HasPermission(PF_NOBAN)) &&
+ !node.m_addr_fetch && !node.fClient;
nPreferredDownload += state->fPreferredDownload;
}
@@ -938,7 +938,7 @@
// one-shots.
static bool IsOutboundDisconnectionCandidate(const CNode &node) {
return !(node.fInbound || node.m_manual_connection || node.fFeeler ||
- node.fOneShot);
+ node.m_addr_fetch);
}
void PeerLogicValidation::InitializeNode(const Config &config, CNode *pnode) {
@@ -2801,7 +2801,7 @@
if (vAddr.size() < 1000) {
pfrom.fGetAddr = false;
}
- if (pfrom.fOneShot) {
+ if (pfrom.m_addr_fetch) {
pfrom.fDisconnect = true;
}
return true;
@@ -4674,8 +4674,9 @@
// Download if this is a nice peer, or we have no nice peers and this one
// might do.
- bool fFetch = state.fPreferredDownload ||
- (nPreferredDownload == 0 && !pto->fClient && !pto->fOneShot);
+ bool fFetch =
+ state.fPreferredDownload ||
+ (nPreferredDownload == 0 && !pto->fClient && !pto->m_addr_fetch);
if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex) {
// Only actively request headers from a single peer, unless we're close

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 1, 11:54 (2 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187725
Default Alt Text
D8711.diff (9 KB)

Event Timeline