if successful, this moves the passed grant to the constructed node
| 1115 | |
| 1116 | // if successful, this moves the passed grant to the constructed node |
| 1117 | bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant* grantOutbound, const char* strDest, |
| 1118 | bool fOneShot) { |
| 1119 | // |
| 1120 | // Initiate outbound network connection |
| 1121 | // |
| 1122 | boost::this_thread::interruption_point(); |
| 1123 | if (!strDest) |
| 1124 | if (IsLocal(addrConnect) || FindNode((CNetAddr)addrConnect) || CNode::IsBanned(addrConnect) || |
| 1125 | FindNode(addrConnect.ToStringIPPort().c_str())) |
| 1126 | return false; |
| 1127 | if (strDest && FindNode(strDest)) |
| 1128 | return false; |
| 1129 | |
| 1130 | CNode* pNode = ConnectNode(addrConnect, strDest); |
| 1131 | boost::this_thread::interruption_point(); |
| 1132 | |
| 1133 | if (!pNode) |
| 1134 | return false; |
| 1135 | if (grantOutbound) |
| 1136 | grantOutbound->MoveTo(pNode->grantOutbound); |
| 1137 | pNode->fNetworkNode = true; |
| 1138 | if (fOneShot) |
| 1139 | pNode->fOneShot = true; |
| 1140 | |
| 1141 | return true; |
| 1142 | } |
| 1143 | |
| 1144 | void static StartSync(const vector<CNode*>& vNodes) { |
| 1145 | CNode* pnodeNewSync = nullptr; |
no test coverage detected