mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Do not add to vNodes until fOneShot/fFeeler/fAddNode have been set
This commit is contained in:
parent
ea73614994
commit
4ee0657f85
17
src/net.cpp
17
src/net.cpp
@ -355,8 +355,8 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
|
||||
CNode* pnode = FindNode((CService)addrConnect);
|
||||
if (pnode)
|
||||
{
|
||||
pnode->AddRef();
|
||||
return pnode;
|
||||
LogPrintf("Failed to open new connection, already connected\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,12 +386,12 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
|
||||
CNode* pnode = FindNode((CService)addrConnect);
|
||||
if (pnode)
|
||||
{
|
||||
pnode->AddRef();
|
||||
if (pnode->addrName.empty()) {
|
||||
pnode->addrName = std::string(pszDest);
|
||||
}
|
||||
CloseSocket(hSocket);
|
||||
return pnode;
|
||||
LogPrintf("Failed to open new connection, already connected\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,9 +406,6 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
|
||||
pnode->nTimeConnected = GetSystemTimeInSeconds();
|
||||
pnode->AddRef();
|
||||
|
||||
GetNodeSignals().InitializeNode(pnode, *this);
|
||||
LOCK(cs_vNodes);
|
||||
vNodes.push_back(pnode);
|
||||
|
||||
return pnode;
|
||||
} else if (!proxyConnectionFailed) {
|
||||
@ -1901,6 +1898,12 @@ bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
|
||||
if (fConnectToMasternode)
|
||||
pnode->fMasternode = true;
|
||||
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
vNodes.push_back(pnode);
|
||||
}
|
||||
GetNodeSignals().InitializeNode(pnode, *this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user