MCPcopy Create free account
hub / github.com/LUX-Core/lux / OpenNetworkConnection

Function OpenNetworkConnection

src/net.cpp:1637–1665  ·  view source on GitHub ↗

if successful, this moves the passed grant to the constructed node

Source from the content-addressed store, hash-verified

1635
1636// if successful, this moves the passed grant to the constructed node
1637bool OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fAddnode)
1638{
1639 //
1640 // Initiate outbound network connection
1641 //
1642 boost::this_thread::interruption_point();
1643 if (!fNetworkActive)
1644 return false;
1645 if (!pszDest) {
1646 if (IsLocal(addrConnect) ||
1647 FindNode((CNetAddr)addrConnect) || CNode::IsBanned(addrConnect) ||
1648 FindNode(addrConnect.ToStringIPPort()))
1649 return false;
1650 } else if (FindNode(pszDest))
1651 return false;
1652
1653 CNode* pnode = ConnectNode(addrConnect, pszDest);
1654 boost::this_thread::interruption_point();
1655
1656 if (!pnode)
1657 return false;
1658 if (grantOutbound)
1659 grantOutbound->MoveTo(pnode->grantOutbound);
1660 pnode->fNetworkNode = true;
1661 if (fOneShot)
1662 pnode->fOneShot = true;
1663
1664 return true;
1665}
1666
1667
1668void ThreadMessageHandler() {

Callers 4

addnodeFunction · 0.85
ProcessOneShotFunction · 0.85
ThreadOpenConnectionsFunction · 0.85

Calls 5

IsLocalFunction · 0.85
ConnectNodeFunction · 0.85
ToStringIPPortMethod · 0.80
MoveToMethod · 0.80
FindNodeFunction · 0.70

Tested by

no test coverage detected