CConnman::OpenNetworkConnection

Open a new P2P connection and initialize it with the PeerManager at m_msgproc.

Synopsis

Declared in <net.h>

[[requires_capability(0x7fbc935f9368, 0x7fbc935f9428), requires_capability(0x7fbc9335ff78, 0x7fbc93360038), requires_capability(0x7fbc874293f8, 0x7fbc874294b8), requires_capability(0x7fbc9745efd8, 0x7fbc9745f098), requires_capability(0x7fbc8e97b118, 0x7fbc8e97b1d8), requires_capability(0x7fbc859fc488, 0x7fbc859fc548), requires_capability(0x7fbc90e398e8, 0x7fbc90e399a8), requires_capability(0x7fbc8ec34a18, 0x7fbc8ec34ad8), requires_capability(0x7fbc92aeced8, 0x7fbc92aecf98), requires_capability(0x7fbc7cdae748, 0x7fbc7cdae808), requires_capability(0x7fbc9fc8a8e8, 0x7fbc9fc8a9a8)]]
bool
OpenNetworkConnection(
    CAddress const& addrConnect,
    bool fCountFailure,
    CountingSemaphoreGrant<>&& grant_outbound,
    char const* pszDest,
    ConnectionType conn_type,
    bool use_v2transport,
    std::optional<Proxy> const& proxy_override);

Return Value

whether the connection was opened successfully.

Parameters

NameDescription
addrConnect [in]Address to connect to, if pszDest is nullptr.
fCountFailure [in]Increment the number of connection attempts to this address in Addrman.
grant_outbound [in]Take ownership of this grant, to be released later when the connection is closed.
pszDest [in]Address to resolve and connect to.
conn_type [in]Type of the connection to open, must not be ConnectionType::INBOUND.
use_v2transport [in]Use P2P encryption, (aka V2 transport, BIP324).
proxy_override [in]Optional proxy to use and override normal proxy selection.