if successful, this moves the passed grant to the constructed node
| 1504 | |
| 1505 | // if successful, this moves the passed grant to the constructed node |
| 1506 | bool OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler) |
| 1507 | { |
| 1508 | // |
| 1509 | // Initiate outbound network connection |
| 1510 | // |
| 1511 | boost::this_thread::interruption_point(); |
| 1512 | if (!pszDest) { |
| 1513 | if (IsLocal(addrConnect) || |
| 1514 | FindNode((CNetAddr)addrConnect) || CNode::IsBanned(addrConnect) || |
| 1515 | FindNode(addrConnect.ToStringIPPort())) |
| 1516 | return false; |
| 1517 | } else if (FindNode(std::string(pszDest))) |
| 1518 | return false; |
| 1519 | |
| 1520 | CNode* pnode = ConnectNode(addrConnect, pszDest, fCountFailure); |
| 1521 | boost::this_thread::interruption_point(); |
| 1522 | |
| 1523 | if (!pnode) |
| 1524 | return false; |
| 1525 | if (grantOutbound) |
| 1526 | grantOutbound->MoveTo(pnode->grantOutbound); |
| 1527 | pnode->fNetworkNode = true; |
| 1528 | if (fOneShot) |
| 1529 | pnode->fOneShot = true; |
| 1530 | if (fFeeler) |
| 1531 | pnode->fFeeler = true; |
| 1532 | |
| 1533 | return true; |
| 1534 | } |
| 1535 | |
| 1536 | |
| 1537 | void ThreadMessageHandler() |
no test coverage detected