Bitcoin Core 30.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
CConnman::PrivateBroadcast Class Reference

Group of private broadcast related members. More...

#include <net.h>

Public Member Functions

std::optional< NetworkPickNetwork (std::optional< Proxy > &proxy) const
 Choose a network to open a connection to. More...
 
size_t NumToOpen () const
 Get the pending number of connections to open. More...
 
void NumToOpenAdd (size_t n)
 Increment the number of new connections of type ConnectionType::PRIVATE_BROADCAST to be opened by CConnman::ThreadPrivateBroadcast(). More...
 
size_t NumToOpenSub (size_t n)
 Decrement the number of new connections of type ConnectionType::PRIVATE_BROADCAST to be opened by CConnman::ThreadPrivateBroadcast(). More...
 
void NumToOpenWait () const
 Wait for the number of needed connections to become greater than 0. More...
 

Public Attributes

std::atomic_bool m_outbound_tor_ok_at_least_once {false}
 Remember if we ever established at least one outbound connection to a Tor peer, including sending and receiving P2P messages. More...
 
std::counting_semaphore m_sem_conn_max {MAX_PRIVATE_BROADCAST_CONNECTIONS}
 Semaphore used to guard against opening too many connections. More...
 

Private Member Functions

std::optional< ProxyProxyForIPv4or6 () const
 Check if private broadcast can be done to IPv4 or IPv6 peers and if so via which proxy. More...
 

Private Attributes

std::atomic_size_t m_num_to_open {0}
 Number of ConnectionType::PRIVATE_BROADCAST connections to open. More...
 

Detailed Description

Group of private broadcast related members.

Definition at line 1193 of file net.h.

Member Function Documentation

◆ NumToOpen()

size_t CConnman::PrivateBroadcast::NumToOpen ( ) const

Get the pending number of connections to open.

Definition at line 3100 of file net.cpp.

Here is the caller graph for this function:

◆ NumToOpenAdd()

void CConnman::PrivateBroadcast::NumToOpenAdd ( size_t  n)

Increment the number of new connections of type ConnectionType::PRIVATE_BROADCAST to be opened by CConnman::ThreadPrivateBroadcast().

Parameters
[in]nIncrement by this number.

Definition at line 3105 of file net.cpp.

Here is the caller graph for this function:

◆ NumToOpenSub()

size_t CConnman::PrivateBroadcast::NumToOpenSub ( size_t  n)

Decrement the number of new connections of type ConnectionType::PRIVATE_BROADCAST to be opened by CConnman::ThreadPrivateBroadcast().

Parameters
[in]nDecrement by this number.
Returns
The number of connections that remain to be opened after the operation.

Definition at line 3111 of file net.cpp.

Here is the caller graph for this function:

◆ NumToOpenWait()

void CConnman::PrivateBroadcast::NumToOpenWait ( ) const

Wait for the number of needed connections to become greater than 0.

Definition at line 3121 of file net.cpp.

Here is the caller graph for this function:

◆ PickNetwork()

std::optional< Network > CConnman::PrivateBroadcast::PickNetwork ( std::optional< Proxy > &  proxy) const

Choose a network to open a connection to.

Parameters
[out]proxyOptional proxy to override the normal proxy selection. Will be set if !std::nullopt is returned. Could be set to std::nullopt if there is no need to override the proxy that would be used for connecting to the returned network.
Return values
std::nulloptNo network could be selected.
!std::nulloptThe network was selected and proxy is set (maybe to std::nullopt).

Definition at line 3067 of file net.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProxyForIPv4or6()

std::optional< Proxy > CConnman::PrivateBroadcast::ProxyForIPv4or6 ( ) const
private

Check if private broadcast can be done to IPv4 or IPv6 peers and if so via which proxy.

If private broadcast connections should not be opened to IPv4 or IPv6, then this will return an empty optional.

Definition at line 3126 of file net.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_num_to_open

std::atomic_size_t CConnman::PrivateBroadcast::m_num_to_open {0}
private

Number of ConnectionType::PRIVATE_BROADCAST connections to open.

Definition at line 1253 of file net.h.

◆ m_outbound_tor_ok_at_least_once

std::atomic_bool CConnman::PrivateBroadcast::m_outbound_tor_ok_at_least_once {false}

Remember if we ever established at least one outbound connection to a Tor peer, including sending and receiving P2P messages.

If this is true then the Tor proxy indeed works and is a proxy to the Tor network, not a misconfigured ordinary SOCKS5 proxy as -proxy or -onion. If that is the case, then we assume that connecting to an IPv4 or IPv6 address via that proxy will be done through the Tor network and a Tor exit node.

Definition at line 1204 of file net.h.

◆ m_sem_conn_max

std::counting_semaphore CConnman::PrivateBroadcast::m_sem_conn_max {MAX_PRIVATE_BROADCAST_CONNECTIONS}

Semaphore used to guard against opening too many connections.

Opening private broadcast connections will be paused if this is equal to 0.

Definition at line 1210 of file net.h.


The documentation for this class was generated from the following files: