if successful, this moves the passed grant to the constructed node
| 1635 | |
| 1636 | // if successful, this moves the passed grant to the constructed node |
| 1637 | bool 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 | |
| 1668 | void ThreadMessageHandler() { |
no test coverage detected