mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-20 12:39:47 +01:00
scripted-diff: Rename OneShot to AddrFetch
-BEGIN VERIFY SCRIPT- sed -i 's/a oneshot/an addrfetch/g' src/chainparams.cpp #comment sed -i 's/oneshot/addrfetch/g' src/net.cpp #comment sed -i 's/AddOneShot/AddAddrFetch/g' src/net.h src/net.cpp sed -i 's/cs_vOneShots/m_addr_fetches_mutex/g' src/net.h src/net.cpp sed -i 's/vOneShots/m_addr_fetches/g' src/net.h src/net.cpp sed -i 's/fOneShot/m_addr_fetch/g' src/net.h src/net.cpp src/net_processing.cpp sed -i 's/ProcessOneShot/ProcessAddrFetch/g' src/net.h src/net.cpp -END VERIFY SCRIPT-
This commit is contained in:
38
src/net.cpp
38
src/net.cpp
@@ -105,10 +105,10 @@ std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(cs_mapLocalHost);
|
||||
static bool vfLimited[NET_MAX] GUARDED_BY(cs_mapLocalHost) = {};
|
||||
std::string strSubVersion;
|
||||
|
||||
void CConnman::AddOneShot(const std::string& strDest)
|
||||
void CConnman::AddAddrFetch(const std::string& strDest)
|
||||
{
|
||||
LOCK(cs_vOneShots);
|
||||
vOneShots.push_back(strDest);
|
||||
LOCK(m_addr_fetches_mutex);
|
||||
m_addr_fetches.push_back(strDest);
|
||||
}
|
||||
|
||||
uint16_t GetListenPort()
|
||||
@@ -1646,7 +1646,7 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
{
|
||||
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) {
|
||||
@@ -1674,7 +1674,7 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
|
||||
LogPrintf("Loading addresses from DNS seed %s\n", seed);
|
||||
if (HaveNameProxy()) {
|
||||
AddOneShot(seed);
|
||||
AddAddrFetch(seed);
|
||||
} else {
|
||||
std::vector<CNetAddr> vIPs;
|
||||
std::vector<CAddress> vAdd;
|
||||
@@ -1696,8 +1696,8 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
addrman.Add(vAdd, resolveSource);
|
||||
} 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);
|
||||
// instead using them as a addrfetch to get nodes with our desired service bits.
|
||||
AddAddrFetch(seed);
|
||||
}
|
||||
}
|
||||
--seeds_right_now;
|
||||
@@ -1727,15 +1727,15 @@ void CConnman::DumpAddresses()
|
||||
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);
|
||||
@@ -1767,7 +1767,7 @@ int CConnman::GetExtraOutboundCount()
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
for (const CNode* pnode : vNodes) {
|
||||
if (!pnode->fInbound && !pnode->m_manual_connection && !pnode->fFeeler && !pnode->fDisconnect && !pnode->fOneShot && pnode->fSuccessfullyConnected) {
|
||||
if (!pnode->fInbound && !pnode->m_manual_connection && !pnode->fFeeler && !pnode->fDisconnect && !pnode->m_addr_fetch && pnode->fSuccessfullyConnected) {
|
||||
++nOutbound;
|
||||
}
|
||||
}
|
||||
@@ -1782,7 +1782,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
|
||||
{
|
||||
for (int64_t nLoop = 0;; nLoop++)
|
||||
{
|
||||
ProcessOneShot();
|
||||
ProcessAddrFetch();
|
||||
for (const std::string& strAddr : connect)
|
||||
{
|
||||
CAddress addr(CService(), NODE_NONE);
|
||||
@@ -1805,7 +1805,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
|
||||
int64_t nNextFeeler = PoissonNextSend(nStart*1000*1000, FEELER_INTERVAL);
|
||||
while (!interruptNet)
|
||||
{
|
||||
ProcessOneShot();
|
||||
ProcessAddrFetch();
|
||||
|
||||
if (!interruptNet.sleep_for(std::chrono::milliseconds(500)))
|
||||
return;
|
||||
@@ -2039,7 +2039,7 @@ void CConnman::ThreadOpenAddedConnections()
|
||||
}
|
||||
|
||||
// if successful, this moves the passed grant to the constructed node
|
||||
void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler, bool manual_connection, bool block_relay_only)
|
||||
void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool m_addr_fetch, bool fFeeler, bool manual_connection, bool block_relay_only)
|
||||
{
|
||||
//
|
||||
// Initiate outbound network connection
|
||||
@@ -2064,8 +2064,8 @@ void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
|
||||
return;
|
||||
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;
|
||||
if (manual_connection)
|
||||
@@ -2337,7 +2337,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
|
||||
}
|
||||
|
||||
for (const auto& strDest : connOptions.vSeedNodes) {
|
||||
AddOneShot(strDest);
|
||||
AddAddrFetch(strDest);
|
||||
}
|
||||
|
||||
if (clientInterface) {
|
||||
|
||||
Reference in New Issue
Block a user