src/net.cpp
void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler, bool manual_connection, bool block_relay_only)
{
    //
    // Initiate outbound network connection
    //
    if (interruptNet) {
        return;
    }
    if (!fNetworkActive) {
        return;
    }
    if (!pszDest) {
        bool banned_or_discouraged = m_banman && (m_banman->IsDiscouraged(addrConnect) || m_banman->IsBanned(addrConnect));
        if (IsLocal(addrConnect) || FindNode(static_cast<CNetAddr>(addrConnect)) || banned_or_discouraged || FindNode(addrConnect.ToStringIPPort())) {
            return;
        }
    } else if (FindNode(std::string(pszDest)))
        return;

    CNode* pnode = ConnectNode(addrConnect, pszDest, fCountFailure, manual_connection, block_relay_only);

    if (!pnode)
        return;
    if (grantOutbound)
        grantOutbound->MoveTo(pnode->grantOutbound);
    if (fOneShot)
        pnode->fOneShot = true;
    if (fFeeler)
        pnode->fFeeler = true;
    if (manual_connection)
        pnode->m_manual_connection = true;

    m_msgproc->InitializeNode(pnode);
    {
        LOCK(cs_vNodes);
        vNodes.push_back(pnode);
    }
}
// if successful, this moves the passed grant to the constructed node
if successful, this moves the passed grant to the constructed node
if successful this moves the passed grant to the constructed node
void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *pszDest, bool fOneShot, bool fFeeler, bool manual_connection, bool block_relay_only)
{
     Initiate outbound network connection
    if (interruptNet) {
        return;
    }
    if (!fNetworkActive) {
        return;
    }
    if (!pszDest) {
        bool banned_or_discouraged = m_banman && (m_banman->IsDiscouraged(addrConnect) || m_banman->IsBanned(addrConnect));
        if (IsLocal(addrConnect) || FindNode(static_cast<CNetAddr>(addrConnect)) || banned_or_discouraged || FindNode(addrConnect.ToStringIPPort())) {
            return;
        }
    } else if (FindNode(std::string(pszDest)))
        return;
    CNode* pnode = ConnectNode(addrConnect, pszDest, fCountFailure, manual_connection, block_relay_only);
    if (!pnode)
        return;
    if (grantOutbound)
        grantOutbound->MoveTo(pnode->grantOutbound);
    if (fOneShot)
        pnode->fOneShot = true;
    if (fFeeler)
        pnode->fFeeler = true;
    if (manual_connection)
        pnode->m_manual_connection = true;
    m_msgproc->InitializeNode(pnode);
    {
        LOCK(cs_vNodes);
        vNodes.push_back(pnode);
    }
}
void CConnman :: OpenNetworkConnection ( const CAddress & addrConnect , bool fCountFailure , CSemaphoreGrant * grantOutbound , const char * pszDest , bool fOneShot , bool fFeeler , bool manual_connection , bool block_relay_only ) { if ( interruptNet ) { return ; } if ( ! fNetworkActive ) { return ; } if ( ! pszDest ) { bool banned_or_discouraged = m_banman && ( m_banman -> IsDiscouraged ( addrConnect ) || m_banman -> IsBanned ( addrConnect ) ) ; if ( IsLocal ( addrConnect ) || FindNode ( static_cast < CNetAddr > ( addrConnect ) ) || banned_or_discouraged || FindNode ( addrConnect . ToStringIPPort ( ) ) ) { return ; } } else if ( FindNode ( std :: string ( pszDest ) ) ) return ; CNode * pnode = ConnectNode ( addrConnect , pszDest , fCountFailure , manual_connection , block_relay_only ) ; if ( ! pnode ) return ; if ( grantOutbound ) grantOutbound -> MoveTo ( pnode -> grantOutbound ) ; if ( fOneShot ) pnode -> fOneShot = true ; if ( fFeeler ) pnode -> fFeeler = true ; if ( manual_connection ) pnode -> m_manual_connection = true ; m_msgproc -> InitializeNode ( pnode ) ; { LOCK ( cs_vNodes ) ; vNodes . push_back ( pnode ) ; } }
if successful, this moves the passed grant to the constructed node
if successful this moves the passed grant to the constructed node
// // Initiate outbound network connection //