mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 15:39:05 +01:00
net: don't retry failed oneshot connections forever
This commit is contained in:
17
src/net.cpp
17
src/net.cpp
@@ -1682,8 +1682,7 @@ void CConnman::ProcessOneShot()
|
||||
CAddress addr;
|
||||
CSemaphoreGrant grant(*semOutbound, true);
|
||||
if (grant) {
|
||||
if (!OpenNetworkConnection(addr, false, &grant, strDest.c_str(), true))
|
||||
AddOneShot(strDest);
|
||||
OpenNetworkConnection(addr, false, &grant, strDest.c_str(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1953,29 +1952,29 @@ void CConnman::ThreadOpenAddedConnections()
|
||||
}
|
||||
|
||||
// if successful, this moves the passed grant to the constructed node
|
||||
bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler, bool manual_connection)
|
||||
void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler, bool manual_connection)
|
||||
{
|
||||
//
|
||||
// Initiate outbound network connection
|
||||
//
|
||||
if (interruptNet) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if (!fNetworkActive) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if (!pszDest) {
|
||||
if (IsLocal(addrConnect) ||
|
||||
FindNode((CNetAddr)addrConnect) || IsBanned(addrConnect) ||
|
||||
FindNode(addrConnect.ToStringIPPort()))
|
||||
return false;
|
||||
return;
|
||||
} else if (FindNode(std::string(pszDest)))
|
||||
return false;
|
||||
return;
|
||||
|
||||
CNode* pnode = ConnectNode(addrConnect, pszDest, fCountFailure);
|
||||
|
||||
if (!pnode)
|
||||
return false;
|
||||
return;
|
||||
if (grantOutbound)
|
||||
grantOutbound->MoveTo(pnode->grantOutbound);
|
||||
if (fOneShot)
|
||||
@@ -1990,8 +1989,6 @@ bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
|
||||
LOCK(cs_vNodes);
|
||||
vNodes.push_back(pnode);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CConnman::ThreadMessageHandler()
|
||||
|
||||
Reference in New Issue
Block a user