Bitcoin Core  27.99.0
P2P Digital Currency
Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
CConnman Class Reference

#include <net.h>

Inheritance diagram for CConnman:
[legend]
Collaboration diagram for CConnman:
[legend]

Classes

struct  CachedAddrResponse
 Cache responses to addr requests to minimize privacy leak. More...
 
struct  ListenSocket
 
class  NodesSnapshot
 RAII helper to atomically create a copy of m_nodes and add a reference to each of the nodes. More...
 
struct  Options
 
struct  ReconnectionInfo
 Struct for entries in m_reconnections. More...
 

Public Types

using NodeFn = std::function< void(CNode *)>
 

Public Member Functions

void Init (const Options &connOptions) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex
 
const bool use_v2transport (GetLocalServices() &NODE_P2P_V2)
 
 for (const std::string &added_node :connOptions.m_added_nodes)
 
 CConnman (uint64_t seed0, uint64_t seed1, AddrMan &addrman, const NetGroupManager &netgroupman, const CChainParams &params, bool network_active=true)
 
 ~CConnman ()
 
bool Start (CScheduler &scheduler, const Options &options) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex
 
void StopThreads ()
 
void StopNodes ()
 
void Stop ()
 
void Interrupt () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc)
 
bool GetNetworkActive () const
 
bool GetUseAddrmanOutgoing () const
 
void SetNetworkActive (bool active)
 
void OpenNetworkConnection (const CAddress &addrConnect, bool fCountFailure, CSemaphoreGrant &&grant_outbound, const char *strDest, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex)
 
bool CheckIncomingNonce (uint64_t nonce)
 
void ASMapHealthCheck ()
 
RecursiveMutexGetNodesMutex () const LOCK_RETURNED(m_nodes_mutex)
 
bool ForNode (NodeId id, std::function< bool(CNode *pnode)> func)
 
void PushMessage (CNode *pnode, CSerializedNetMsg &&msg) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
 
void ForEachNode (const NodeFn &func)
 
void ForEachNode (const NodeFn &func) const
 
std::vector< CAddressGetAddresses (size_t max_addresses, size_t max_pct, std::optional< Network > network, const bool filtered=true) const
 Return all or many randomly selected addresses, optionally by network. More...
 
std::vector< CAddressGetAddresses (CNode &requestor, size_t max_addresses, size_t max_pct)
 Cache is used to minimize topology leaks, so it should be used for all non-trusted calls, for example, p2p. More...
 
void SetTryNewOutboundPeer (bool flag)
 
bool GetTryNewOutboundPeer () const
 
void StartExtraBlockRelayPeers ()
 
int GetExtraFullOutboundCount () const
 
int GetExtraBlockRelayCount () const
 
bool AddNode (const AddedNodeParams &add) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex)
 
bool RemoveAddedNode (const std::string &node) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex)
 
bool AddedNodesContain (const CAddress &addr) const EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex)
 
std::vector< AddedNodeInfoGetAddedNodeInfo (bool include_connected) const EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex)
 
bool AddConnection (const std::string &address, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex)
 Attempts to open a connection. More...
 
size_t GetNodeCount (ConnectionDirection) const
 
uint32_t GetMappedAS (const CNetAddr &addr) const
 
void GetNodeStats (std::vector< CNodeStats > &vstats) const
 
bool DisconnectNode (const std::string &node)
 
bool DisconnectNode (const CSubNet &subnet)
 
bool DisconnectNode (const CNetAddr &addr)
 
bool DisconnectNode (NodeId id)
 
ServiceFlags GetLocalServices () const
 Used to convey which local services we are offering peers during node connection. More...
 
uint64_t GetMaxOutboundTarget () const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
 
std::chrono::seconds GetMaxOutboundTimeframe () const
 
bool OutboundTargetReached (bool historicalBlockServingLimit) const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
 check if the outbound target is reached if param historicalBlockServingLimit is set true, the function will response true if the limit for serving historical blocks has been reached More...
 
uint64_t GetOutboundTargetBytesLeft () const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
 response the bytes left in the current max outbound cycle in case of no limit, it will always response 0 More...
 
std::chrono::seconds GetMaxOutboundTimeLeftInCycle () const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
 
uint64_t GetTotalBytesRecv () const
 
uint64_t GetTotalBytesSent () const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
 
CSipHasher GetDeterministicRandomizer (uint64_t id) const
 Get a unique deterministic randomizer. More...
 
void WakeMessageHandler () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc)
 
bool ShouldRunInactivityChecks (const CNode &node, std::chrono::seconds now) const
 Return true if we should disconnect the peer for failing an inactivity check. More...
 
bool MultipleManualOrFullOutboundConns (Network net) const EXCLUSIVE_LOCKS_REQUIRED(m_nodes_mutex)
 

Public Attributes

void !m_total_bytes_sent_mutex
 
 nLocalServices = connOptions.nLocalServices
 
 m_max_automatic_connections = connOptions.m_max_automatic_connections
 
 m_max_outbound_full_relay = std::min(MAX_OUTBOUND_FULL_RELAY_CONNECTIONS, m_max_automatic_connections)
 
 m_max_outbound_block_relay = std::min(MAX_BLOCK_RELAY_ONLY_CONNECTIONS, m_max_automatic_connections - m_max_outbound_full_relay)
 
 m_max_automatic_outbound = m_max_outbound_full_relay + m_max_outbound_block_relay + m_max_feeler
 
 m_max_inbound = std::max(0, m_max_automatic_connections - m_max_automatic_outbound)
 
 m_use_addrman_outgoing = connOptions.m_use_addrman_outgoing
 
 m_client_interface = connOptions.uiInterface
 
 m_banman = connOptions.m_banman
 
 m_msgproc = connOptions.m_msgproc
 
 nSendBufferMaxSize = connOptions.nSendBufferMaxSize
 
 nReceiveFloodSize = connOptions.nReceiveFloodSize
 
 m_peer_connect_timeout = std::chrono::seconds{connOptions.m_peer_connect_timeout}
 
 nMaxOutboundLimit = connOptions.nMaxOutboundLimit
 
 vWhitelistedRangeIncoming = connOptions.vWhitelistedRangeIncoming
 
 vWhitelistedRangeOutgoing = connOptions.vWhitelistedRangeOutgoing
 
 m_onion_binds = connOptions.onion_binds
 
 whitelist_forcerelay = connOptions.whitelist_forcerelay
 
 whitelist_relay = connOptions.whitelist_relay
 
bool !m_added_nodes_mutex
 
bool !m_addr_fetches_mutex
 
bool !mutexMsgProc
 

Private Member Functions

std::chrono::seconds GetMaxOutboundTimeLeftInCycle_ () const EXCLUSIVE_LOCKS_REQUIRED(m_total_bytes_sent_mutex)
 returns the time left in the current max outbound cycle in case of no limit, it will always return 0 More...
 
bool BindListenPort (const CService &bindAddr, bilingual_str &strError, NetPermissionFlags permissions)
 
bool Bind (const CService &addr, unsigned int flags, NetPermissionFlags permissions)
 
bool InitBinds (const Options &options)
 
void ThreadOpenAddedConnections () EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex
 
void AddAddrFetch (const std::string &strDest) EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex)
 
void ProcessAddrFetch () EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex
 
void ThreadOpenConnections (std::vector< std::string > connect) EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex
 
void ThreadMessageHandler () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc)
 
void ThreadI2PAcceptIncoming ()
 
void AcceptConnection (const ListenSocket &hListenSocket)
 
void CreateNodeFromAcceptedSocket (std::unique_ptr< Sock > &&sock, NetPermissionFlags permission_flags, const CAddress &addr_bind, const CAddress &addr)
 Create a CNode object from a socket that has just been accepted and add the node to the m_nodes member. More...
 
void DisconnectNodes () EXCLUSIVE_LOCKS_REQUIRED(!m_reconnections_mutex
 
void NotifyNumConnectionsChanged ()
 
bool InactivityCheck (const CNode &node) const
 Return true if the peer is inactive and should be disconnected. More...
 
Sock::EventsPerSock GenerateWaitSockets (Span< CNode *const > nodes)
 Generate a collection of sockets to check for IO readiness. More...
 
void SocketHandler () EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex
 Check connected and listening sockets for IO readiness and process them accordingly. More...
 
void SocketHandlerConnected (const std::vector< CNode * > &nodes, const Sock::EventsPerSock &events_per_sock) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex
 Do the read/write for connected sockets that are ready for IO. More...
 
void SocketHandlerListening (const Sock::EventsPerSock &events_per_sock)
 Accept incoming connections, one from each read-ready listening socket. More...
 
void ThreadSocketHandler () EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex
 
void ThreadDNSAddressSeed () EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex
 
uint64_t CalculateKeyedNetGroup (const CAddress &ad) const
 
CNodeFindNode (const CNetAddr &ip)
 
CNodeFindNode (const std::string &addrName)
 
CNodeFindNode (const CService &addr)
 
bool AlreadyConnectedToAddress (const CAddress &addr)
 Determine whether we're already connected to a given address, in order to avoid initiating duplicate connections. More...
 
bool AttemptToEvictConnection ()
 Try to find a connection to evict when the node is full. More...
 
CNodeConnectNode (CAddress addrConnect, const char *pszDest, bool fCountFailure, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex)
 
void AddWhitelistPermissionFlags (NetPermissionFlags &flags, const CNetAddr &addr, const std::vector< NetWhitelistPermissions > &ranges) const
 
void DeleteNode (CNode *pnode)
 
NodeId GetNewNodeId ()
 
std::pair< size_t, bool > SocketSendData (CNode &node) const EXCLUSIVE_LOCKS_REQUIRED(node.cs_vSend)
 (Try to) send data from node's vSendMsg. More...
 
void DumpAddresses ()
 
void RecordBytesRecv (uint64_t bytes)
 
void RecordBytesSent (uint64_t bytes) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
 
std::unordered_set< NetworkGetReachableEmptyNetworks () const
 Return reachable networks for which we have no addresses in addrman and therefore may require loading fixed seeds. More...
 
std::vector< CAddressGetCurrentBlockRelayOnlyConns () const
 Return vector of current BLOCK_RELAY peers. More...
 
bool MaybePickPreferredNetwork (std::optional< Network > &network)
 Search for a "preferred" network, a reachable network to which we currently don't have any OUTBOUND_FULL_RELAY or MANUAL connections. More...
 
uint16_t GetDefaultPort (Network net) const
 
uint16_t GetDefaultPort (const std::string &addr) const
 
uint64_t nTotalBytesSent GUARDED_BY (m_total_bytes_sent_mutex)
 
uint64_t nMaxOutboundTotalBytesSentInCycle GUARDED_BY (m_total_bytes_sent_mutex)
 
std::chrono::seconds nMaxOutboundCycleStartTime GUARDED_BY (m_total_bytes_sent_mutex)
 
uint64_t nMaxOutboundLimit GUARDED_BY (m_total_bytes_sent_mutex)
 
std::deque< std::string > m_addr_fetches GUARDED_BY (m_addr_fetches_mutex)
 
std::vector< AddedNodeParams > m_added_node_params GUARDED_BY (m_added_nodes_mutex)
 
std::vector< CNode * > m_nodes GUARDED_BY (m_nodes_mutex)
 
std::array< unsigned int, Network::NET_MAX > m_network_conn_counts GUARDED_BY (m_nodes_mutex)
 
bool fMsgProcWake GUARDED_BY (mutexMsgProc)
 flag for waking the message processor. More...
 
std::queue< std::unique_ptr< i2p::sam::Session > > m_unused_i2p_sessions GUARDED_BY (m_unused_i2p_sessions_mutex)
 A pool of created I2P SAM transient sessions that should be used instead of creating new ones in order to reduce the load on the I2P network. More...
 
std::list< ReconnectionInfo > m_reconnections GUARDED_BY (m_reconnections_mutex)
 List of reconnections we have to make. More...
 
void PerformReconnections () EXCLUSIVE_LOCKS_REQUIRED(!m_reconnections_mutex
 Attempt reconnections, if m_reconnections non-empty. More...
 

Static Private Member Functions

static bool NodeFullyConnected (const CNode *pnode)
 

Private Attributes

void !m_unused_i2p_sessions_mutex
 
void !m_reconnections_mutex
 
void !m_added_nodes_mutex
 
void !m_nodes_mutex
 
void !mutexMsgProc
 
Mutex m_total_bytes_sent_mutex
 
std::atomic< uint64_t > nTotalBytesRecv {0}
 
std::chrono::seconds m_peer_connect_timeout
 
std::vector< NetWhitelistPermissionsvWhitelistedRangeIncoming
 
std::vector< NetWhitelistPermissionsvWhitelistedRangeOutgoing
 
unsigned int nSendBufferMaxSize {0}
 
unsigned int nReceiveFloodSize {0}
 
std::vector< ListenSocketvhListenSocket
 
std::atomic< bool > fNetworkActive {true}
 
bool fAddressesInitialized {false}
 
AddrManaddrman
 
const NetGroupManagerm_netgroupman
 
Mutex m_addr_fetches_mutex
 
Mutex m_added_nodes_mutex
 
std::list< CNode * > m_nodes_disconnected
 
RecursiveMutex m_nodes_mutex
 
std::atomic< NodeIdnLastNodeId {0}
 
unsigned int nPrevNodeCount {0}
 
std::map< uint64_t, CachedAddrResponsem_addr_response_caches
 Addr responses stored in different caches per (network, local socket) prevent cross-network node identification. More...
 
ServiceFlags nLocalServices
 Services this node offers. More...
 
std::unique_ptr< CSemaphoresemOutbound
 
std::unique_ptr< CSemaphoresemAddnode
 
int m_max_automatic_connections
 Maximum number of automatic connections permitted, excluding manual connections but including inbounds. More...
 
int m_max_outbound_full_relay
 
int m_max_outbound_block_relay
 
int m_max_addnode {MAX_ADDNODE_CONNECTIONS}
 
int m_max_feeler {MAX_FEELER_CONNECTIONS}
 
int m_max_automatic_outbound
 
int m_max_inbound
 
bool m_use_addrman_outgoing
 
CClientUIInterfacem_client_interface
 
NetEventsInterfacem_msgproc
 
BanManm_banman
 Pointer to this node's banman. More...
 
std::vector< CAddressm_anchors
 Addresses that were saved during the previous clean shutdown. More...
 
const uint64_t nSeed0
 SipHasher seeds for deterministic randomness. More...
 
const uint64_t nSeed1
 
std::condition_variable condMsgProc
 
Mutex mutexMsgProc
 
std::atomic< bool > flagInterruptMsgProc {false}
 
CThreadInterrupt interruptNet
 This is signaled when network activity should cease. More...
 
std::unique_ptr< i2p::sam::Sessionm_i2p_sam_session
 I2P SAM session. More...
 
std::thread threadDNSAddressSeed
 
std::thread threadSocketHandler
 
std::thread threadOpenAddedConnections
 
std::thread threadOpenConnections
 
std::thread threadMessageHandler
 
std::thread threadI2PAcceptIncoming
 
std::atomic_bool m_try_another_outbound_peer
 flag for deciding to connect to an extra outbound peer, in excess of m_max_outbound_full_relay This takes the place of a feeler connection More...
 
std::atomic_bool m_start_extra_block_relay_peers {false}
 flag for initiating extra block-relay-only peer connections. More...
 
std::vector< CServicem_onion_binds
 A vector of -bind=<address>:<port>=onion arguments each of which is an address and port that are designated for incoming Tor connections. More...
 
bool whitelist_forcerelay
 flag for adding 'forcerelay' permission to whitelisted inbound and manual peers with default permissions. More...
 
bool whitelist_relay
 flag for adding 'relay' permission to whitelisted inbound and manual peers with default permissions. More...
 
Mutex m_unused_i2p_sessions_mutex
 Mutex protecting m_i2p_sam_sessions. More...
 
Mutex m_reconnections_mutex
 Mutex protecting m_reconnections. More...
 
const CChainParamsm_params
 

Static Private Attributes

static constexpr size_t MAX_UNUSED_I2P_SESSIONS_SIZE {10}
 Cap on the size of m_unused_i2p_sessions, to ensure it does not unexpectedly use too much memory. More...
 

Friends

struct ConnmanTestMsg
 

Detailed Description

Definition at line 1035 of file net.h.

Member Typedef Documentation

◆ NodeFn

using CConnman::NodeFn = std::function<void(CNode*)>

Definition at line 1134 of file net.h.

Constructor & Destructor Documentation

◆ CConnman()

CConnman::CConnman ( uint64_t  seed0,
uint64_t  seed1,
AddrMan addrman,
const NetGroupManager netgroupman,
const CChainParams params,
bool  network_active = true 
)

Definition at line 3097 of file net.cpp.

Here is the call graph for this function:

◆ ~CConnman()

CConnman::~CConnman ( )

Definition at line 3370 of file net.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ AcceptConnection()

void CConnman::AcceptConnection ( const ListenSocket hListenSocket)
private

Definition at line 1689 of file net.cpp.

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

◆ AddAddrFetch()

void CConnman::AddAddrFetch ( const std::string &  strDest)
private

Definition at line 129 of file net.cpp.

Here is the caller graph for this function:

◆ AddConnection()

bool CConnman::AddConnection ( const std::string &  address,
ConnectionType  conn_type,
bool  use_v2transport = false 
)

Attempts to open a connection.

Currently only used from tests.

Parameters
[in]addressAddress of node to try connecting to
[in]conn_typeConnectionType::OUTBOUND, ConnectionType::BLOCK_RELAY, ConnectionType::ADDR_FETCH or ConnectionType::FEELER
[in]use_v2transportSet to true if node attempts to connect using BIP 324 v2 transport protocol.
Returns
bool Returns false if there are no available slots for this connection:
  • conn_type not a supported ConnectionType
  • Max total outbound connection capacity filled
  • Max connection capacity for type is filled

Definition at line 1813 of file net.cpp.

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

◆ AddedNodesContain()

bool CConnman::AddedNodesContain ( const CAddress addr) const

Definition at line 3457 of file net.cpp.

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

◆ AddNode()

bool CConnman::AddNode ( const AddedNodeParams add)

Definition at line 3431 of file net.cpp.

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

◆ AddWhitelistPermissionFlags()

void CConnman::AddWhitelistPermissionFlags ( NetPermissionFlags flags,
const CNetAddr addr,
const std::vector< NetWhitelistPermissions > &  ranges 
) const
private

Definition at line 547 of file net.cpp.

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

◆ AlreadyConnectedToAddress()

bool CConnman::AlreadyConnectedToAddress ( const CAddress addr)
private

Determine whether we're already connected to a given address, in order to avoid initiating duplicate connections.

Definition at line 360 of file net.cpp.

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

◆ ASMapHealthCheck()

void CConnman::ASMapHealthCheck ( )

Definition at line 3833 of file net.cpp.

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

◆ AttemptToEvictConnection()

bool CConnman::AttemptToEvictConnection ( )
private

Try to find a connection to evict when the node is full.

Extreme care must be taken to avoid opening the node to attacker triggered network partitioning. The strategy used here is to protect a small number of peers for each of several distinct characteristics which are difficult to forge. In order to partition a node the attacker must be simultaneously better at all of them than honest peers.

Definition at line 1646 of file net.cpp.

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

◆ Bind()

bool CConnman::Bind ( const CService addr,
unsigned int  flags,
NetPermissionFlags  permissions 
)
private

Definition at line 3128 of file net.cpp.

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

◆ BindListenPort()

bool CConnman::BindListenPort ( const CService bindAddr,
bilingual_str strError,
NetPermissionFlags  permissions 
)
private

Definition at line 2965 of file net.cpp.

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

◆ CalculateKeyedNetGroup()

uint64_t CConnman::CalculateKeyedNetGroup ( const CAddress ad) const
private

Definition at line 3799 of file net.cpp.

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

◆ CheckIncomingNonce()

bool CConnman::CheckIncomingNonce ( uint64_t  nonce)

Definition at line 365 of file net.cpp.

◆ ConnectNode()

CNode * CConnman::ConnectNode ( CAddress  addrConnect,
const char *  pszDest,
bool  fCountFailure,
ConnectionType  conn_type,
bool  use_v2transport 
)
private

Definition at line 389 of file net.cpp.

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

◆ CreateNodeFromAcceptedSocket()

void CConnman::CreateNodeFromAcceptedSocket ( std::unique_ptr< Sock > &&  sock,
NetPermissionFlags  permission_flags,
const CAddress addr_bind,
const CAddress addr 
)
private

Create a CNode object from a socket that has just been accepted and add the node to the m_nodes member.

Parameters
[in]sockConnected socket to communicate with the peer.
[in]permission_flagsThe peer's permissions.
[in]addr_bindThe address and port at our side of the connection.
[in]addrThe address and port at the peer's side of the connection.

Definition at line 1717 of file net.cpp.

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

◆ DeleteNode()

void CConnman::DeleteNode ( CNode pnode)
private

Definition at line 3363 of file net.cpp.

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

◆ DisconnectNode() [1/4]

bool CConnman::DisconnectNode ( const CNetAddr addr)

Definition at line 3526 of file net.cpp.

Here is the call graph for this function:

◆ DisconnectNode() [2/4]

bool CConnman::DisconnectNode ( const CSubNet subnet)

Definition at line 3512 of file net.cpp.

Here is the call graph for this function:

◆ DisconnectNode() [3/4]

bool CConnman::DisconnectNode ( const std::string &  node)

Definition at line 3501 of file net.cpp.

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

◆ DisconnectNode() [4/4]

bool CConnman::DisconnectNode ( NodeId  id)

Definition at line 3531 of file net.cpp.

◆ DisconnectNodes()

void CConnman::DisconnectNodes ( )
private

Definition at line 1850 of file net.cpp.

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

◆ DumpAddresses()

void CConnman::DumpAddresses ( )
private

Definition at line 2281 of file net.cpp.

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

◆ FindNode() [1/3]

CNode * CConnman::FindNode ( const CNetAddr ip)
private

Definition at line 327 of file net.cpp.

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

◆ FindNode() [2/3]

CNode * CConnman::FindNode ( const CService addr)
private

Definition at line 349 of file net.cpp.

◆ FindNode() [3/3]

CNode * CConnman::FindNode ( const std::string &  addrName)
private

Definition at line 338 of file net.cpp.

◆ for()

CConnman::for ( const std::string &added_node :connOptions.  m_added_nodes)
inline

Definition at line 1095 of file net.h.

◆ ForEachNode() [1/2]

void CConnman::ForEachNode ( const NodeFn func)
inline

Definition at line 1135 of file net.h.

◆ ForEachNode() [2/2]

void CConnman::ForEachNode ( const NodeFn func) const
inline

Definition at line 1144 of file net.h.

◆ ForNode()

bool CConnman::ForNode ( NodeId  id,
std::function< bool(CNode *pnode)>  func 
)

Definition at line 3781 of file net.cpp.

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

◆ GenerateWaitSockets()

Sock::EventsPerSock CConnman::GenerateWaitSockets ( Span< CNode *const >  nodes)
private

Generate a collection of sockets to check for IO readiness.

Parameters
[in]nodesSelect from these nodes' sockets.
Returns
sockets to check for readiness

Definition at line 1981 of file net.cpp.

Here is the caller graph for this function:

◆ GetAddedNodeInfo()

std::vector< AddedNodeInfo > CConnman::GetAddedNodeInfo ( bool  include_connected) const

Definition at line 2752 of file net.cpp.

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

◆ GetAddresses() [1/2]

std::vector< CAddress > CConnman::GetAddresses ( CNode requestor,
size_t  max_addresses,
size_t  max_pct 
)

Cache is used to minimize topology leaks, so it should be used for all non-trusted calls, for example, p2p.

A non-malicious call (from RPC or a peer with addr permission) should call the function without a parameter to avoid using the cache.

Definition at line 3387 of file net.cpp.

Here is the call graph for this function:

◆ GetAddresses() [2/2]

std::vector< CAddress > CConnman::GetAddresses ( size_t  max_addresses,
size_t  max_pct,
std::optional< Network network,
const bool  filtered = true 
) const

Return all or many randomly selected addresses, optionally by network.

Parameters
[in]max_addressesMaximum number of addresses to return (0 = all).
[in]max_pctMaximum percentage of addresses to return (0 = all).
[in]networkSelect only addresses of this network (nullopt = all).
[in]filteredSelect only addresses that are considered high quality (false = all).

Definition at line 3376 of file net.cpp.

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

◆ GetCurrentBlockRelayOnlyConns()

std::vector< CAddress > CConnman::GetCurrentBlockRelayOnlyConns ( ) const
private

Return vector of current BLOCK_RELAY peers.

Definition at line 2739 of file net.cpp.

Here is the caller graph for this function:

◆ GetDefaultPort() [1/2]

uint16_t CConnman::GetDefaultPort ( const std::string &  addr) const
private

Definition at line 3122 of file net.cpp.

Here is the call graph for this function:

◆ GetDefaultPort() [2/2]

uint16_t CConnman::GetDefaultPort ( Network  net) const
private

Definition at line 3117 of file net.cpp.

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

◆ GetDeterministicRandomizer()

CSipHasher CConnman::GetDeterministicRandomizer ( uint64_t  id) const

Get a unique deterministic randomizer.

Definition at line 3794 of file net.cpp.

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

◆ GetExtraBlockRelayCount()

int CConnman::GetExtraBlockRelayCount ( ) const

Definition at line 2349 of file net.cpp.

◆ GetExtraFullOutboundCount()

int CConnman::GetExtraFullOutboundCount ( ) const

Definition at line 2335 of file net.cpp.

◆ GetLocalServices()

ServiceFlags CConnman::GetLocalServices ( ) const

Used to convey which local services we are offering peers during node connection.

The data returned by this is used in CNode construction, which is used to advertise which services we are offering that peer during net_processing.cpp:PushNodeVersion().

Definition at line 3644 of file net.cpp.

Here is the caller graph for this function:

◆ GetMappedAS()

uint32_t CConnman::GetMappedAS ( const CNetAddr addr) const

Definition at line 3484 of file net.cpp.

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

◆ GetMaxOutboundTarget()

uint64_t CConnman::GetMaxOutboundTarget ( ) const

Definition at line 3567 of file net.cpp.

Here is the caller graph for this function:

◆ GetMaxOutboundTimeframe()

std::chrono::seconds CConnman::GetMaxOutboundTimeframe ( ) const

Definition at line 3574 of file net.cpp.

Here is the caller graph for this function:

◆ GetMaxOutboundTimeLeftInCycle()

std::chrono::seconds CConnman::GetMaxOutboundTimeLeftInCycle ( ) const

Definition at line 3579 of file net.cpp.

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

◆ GetMaxOutboundTimeLeftInCycle_()

std::chrono::seconds CConnman::GetMaxOutboundTimeLeftInCycle_ ( ) const
private

returns the time left in the current max outbound cycle in case of no limit, it will always return 0

Definition at line 3586 of file net.cpp.

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

◆ GetNetworkActive()

bool CConnman::GetNetworkActive ( ) const
inline

Definition at line 1120 of file net.h.

Here is the caller graph for this function:

◆ GetNewNodeId()

NodeId CConnman::GetNewNodeId ( )
private

Definition at line 3112 of file net.cpp.

Here is the caller graph for this function:

◆ GetNodeCount()

size_t CConnman::GetNodeCount ( ConnectionDirection  flags) const

Definition at line 3468 of file net.cpp.

Here is the caller graph for this function:

◆ GetNodesMutex()

RecursiveMutex& CConnman::GetNodesMutex ( ) const

◆ GetNodeStats()

void CConnman::GetNodeStats ( std::vector< CNodeStats > &  vstats) const

Definition at line 3489 of file net.cpp.

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

◆ GetOutboundTargetBytesLeft()

uint64_t CConnman::GetOutboundTargetBytesLeft ( ) const

response the bytes left in the current max outbound cycle in case of no limit, it will always response 0

Definition at line 3622 of file net.cpp.

Here is the caller graph for this function:

◆ GetReachableEmptyNetworks()

std::unordered_set< Network > CConnman::GetReachableEmptyNetworks ( ) const
private

Return reachable networks for which we have no addresses in addrman and therefore may require loading fixed seeds.

Definition at line 2363 of file net.cpp.

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

◆ GetTotalBytesRecv()

uint64_t CConnman::GetTotalBytesRecv ( ) const

Definition at line 3632 of file net.cpp.

Here is the caller graph for this function:

◆ GetTotalBytesSent()

uint64_t CConnman::GetTotalBytesSent ( ) const

Definition at line 3637 of file net.cpp.

Here is the caller graph for this function:

◆ GetTryNewOutboundPeer()

bool CConnman::GetTryNewOutboundPeer ( ) const

Definition at line 2312 of file net.cpp.

Here is the caller graph for this function:

◆ GetUseAddrmanOutgoing()

bool CConnman::GetUseAddrmanOutgoing ( ) const
inline

Definition at line 1121 of file net.h.

◆ GUARDED_BY() [1/11]

std::vector<AddedNodeParams> m_added_node_params CConnman::GUARDED_BY ( m_added_nodes_mutex  )
private

◆ GUARDED_BY() [2/11]

std::deque<std::string> m_addr_fetches CConnman::GUARDED_BY ( m_addr_fetches_mutex  )
private

◆ GUARDED_BY() [3/11]

std::vector<CNode*> m_nodes CConnman::GUARDED_BY ( m_nodes_mutex  )
private

◆ GUARDED_BY() [4/11]

std::array<unsigned int, Network::NET_MAX> m_network_conn_counts CConnman::GUARDED_BY ( m_nodes_mutex  )
private

◆ GUARDED_BY() [5/11]

std::list<ReconnectionInfo> m_reconnections CConnman::GUARDED_BY ( m_reconnections_mutex  )
private

List of reconnections we have to make.

◆ GUARDED_BY() [6/11]

uint64_t nTotalBytesSent CConnman::GUARDED_BY ( m_total_bytes_sent_mutex  )
inlineprivate

Definition at line 1390 of file net.h.

◆ GUARDED_BY() [7/11]

uint64_t nMaxOutboundTotalBytesSentInCycle CConnman::GUARDED_BY ( m_total_bytes_sent_mutex  )
inlineprivate

Definition at line 1393 of file net.h.

◆ GUARDED_BY() [8/11]

std::chrono::seconds nMaxOutboundCycleStartTime CConnman::GUARDED_BY ( m_total_bytes_sent_mutex  )
inlineprivate

Definition at line 1394 of file net.h.

◆ GUARDED_BY() [9/11]

uint64_t nMaxOutboundLimit CConnman::GUARDED_BY ( m_total_bytes_sent_mutex  )
private

◆ GUARDED_BY() [10/11]

std::queue<std::unique_ptr<i2p::sam::Session> > m_unused_i2p_sessions CConnman::GUARDED_BY ( m_unused_i2p_sessions_mutex  )
private

A pool of created I2P SAM transient sessions that should be used instead of creating new ones in order to reduce the load on the I2P network.

Creating a session in I2P is not cheap, thus if this is not empty, then pick an entry from it instead of creating a new session. If connecting to a host fails, then the created session is put to this pool for reuse.

◆ GUARDED_BY() [11/11]

bool fMsgProcWake CConnman::GUARDED_BY ( mutexMsgProc  )
private

flag for waking the message processor.

◆ InactivityCheck()

bool CConnman::InactivityCheck ( const CNode node) const
private

Return true if the peer is inactive and should be disconnected.

Definition at line 1948 of file net.cpp.

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

◆ Init()

void CConnman::Init ( const Options connOptions)
Here is the caller graph for this function:

◆ InitBinds()

bool CConnman::InitBinds ( const Options options)
private

Definition at line 3147 of file net.cpp.

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

◆ Interrupt()

void CConnman::Interrupt ( )

Definition at line 3289 of file net.cpp.

Here is the caller graph for this function:

◆ MaybePickPreferredNetwork()

bool CConnman::MaybePickPreferredNetwork ( std::optional< Network > &  network)
private

Search for a "preferred" network, a reachable network to which we currently don't have any OUTBOUND_FULL_RELAY or MANUAL connections.

There needs to be at least one address in AddrMan for a preferred network to be picked.

Parameters
[out]networkPreferred network, if found.
Returns
bool Whether a preferred network was found.

Definition at line 2382 of file net.cpp.

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

◆ MultipleManualOrFullOutboundConns()

bool CConnman::MultipleManualOrFullOutboundConns ( Network  net) const

Definition at line 2376 of file net.cpp.

Here is the call graph for this function:

◆ NodeFullyConnected()

bool CConnman::NodeFullyConnected ( const CNode pnode)
staticprivate

Definition at line 3729 of file net.cpp.

Here is the caller graph for this function:

◆ NotifyNumConnectionsChanged()

void CConnman::NotifyNumConnectionsChanged ( )
private

Definition at line 1928 of file net.cpp.

Here is the caller graph for this function:

◆ OpenNetworkConnection()

void CConnman::OpenNetworkConnection ( const CAddress addrConnect,
bool  fCountFailure,
CSemaphoreGrant &&  grant_outbound,
const char *  strDest,
ConnectionType  conn_type,
bool  use_v2transport 
)

Definition at line 2842 of file net.cpp.

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

◆ OutboundTargetReached()

bool CConnman::OutboundTargetReached ( bool  historicalBlockServingLimit) const

check if the outbound target is reached if param historicalBlockServingLimit is set true, the function will response true if the limit for serving historical blocks has been reached

Definition at line 3601 of file net.cpp.

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

◆ PerformReconnections()

void CConnman::PerformReconnections ( )
private

Attempt reconnections, if m_reconnections non-empty.

Definition at line 3806 of file net.cpp.

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

◆ ProcessAddrFetch()

void CConnman::ProcessAddrFetch ( )
private

Definition at line 2291 of file net.cpp.

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

◆ PushMessage()

void CConnman::PushMessage ( CNode pnode,
CSerializedNetMsg &&  msg 
)

Definition at line 3734 of file net.cpp.

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

◆ RecordBytesRecv()

void CConnman::RecordBytesRecv ( uint64_t  bytes)
private

Definition at line 3544 of file net.cpp.

Here is the caller graph for this function:

◆ RecordBytesSent()

void CConnman::RecordBytesSent ( uint64_t  bytes)
private

Definition at line 3549 of file net.cpp.

Here is the caller graph for this function:

◆ RemoveAddedNode()

bool CConnman::RemoveAddedNode ( const std::string &  node)

Definition at line 3445 of file net.cpp.

Here is the caller graph for this function:

◆ SetNetworkActive()

void CConnman::SetNetworkActive ( bool  active)

Definition at line 3082 of file net.cpp.

Here is the caller graph for this function:

◆ SetTryNewOutboundPeer()

void CConnman::SetTryNewOutboundPeer ( bool  flag)

Definition at line 2317 of file net.cpp.

Here is the caller graph for this function:

◆ ShouldRunInactivityChecks()

bool CConnman::ShouldRunInactivityChecks ( const CNode node,
std::chrono::seconds  now 
) const

Return true if we should disconnect the peer for failing an inactivity check.

Definition at line 1943 of file net.cpp.

Here is the caller graph for this function:

◆ SocketHandler()

void CConnman::SocketHandler ( )
private

Check connected and listening sockets for IO readiness and process them accordingly.

Definition at line 2012 of file net.cpp.

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

◆ SocketHandlerConnected()

void CConnman::SocketHandlerConnected ( const std::vector< CNode * > &  nodes,
const Sock::EventsPerSock events_per_sock 
)
private

Do the read/write for connected sockets that are ready for IO.

Parameters
[in]nodesNodes to process. The socket of each node is checked against what.
[in]events_per_sockSockets that are ready for IO.

Definition at line 2040 of file net.cpp.

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

◆ SocketHandlerListening()

void CConnman::SocketHandlerListening ( const Sock::EventsPerSock events_per_sock)
private

Accept incoming connections, one from each read-ready listening socket.

Parameters
[in]events_per_sockSockets that are ready for IO.

Definition at line 2135 of file net.cpp.

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

◆ SocketSendData()

std::pair< size_t, bool > CConnman::SocketSendData ( CNode node) const
private

(Try to) send data from node's vSendMsg.

Returns (bytes_sent, data_left).

< second return value (whether unsent data remains)

Definition at line 1559 of file net.cpp.

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

◆ Start()

bool CConnman::Start ( CScheduler scheduler,
const Options options 
)

Definition at line 3169 of file net.cpp.

Here is the call graph for this function:

◆ StartExtraBlockRelayPeers()

void CConnman::StartExtraBlockRelayPeers ( )

Definition at line 2323 of file net.cpp.

◆ Stop()

void CConnman::Stop ( )
inline

Definition at line 1113 of file net.h.

Here is the caller graph for this function:

◆ StopNodes()

void CConnman::StopNodes ( )

Definition at line 3330 of file net.cpp.

Here is the call graph for this function:

◆ StopThreads()

void CConnman::StopThreads ( )

Definition at line 3313 of file net.cpp.

◆ ThreadDNSAddressSeed()

void CConnman::ThreadDNSAddressSeed ( )
private

Definition at line 2169 of file net.cpp.

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

◆ ThreadI2PAcceptIncoming()

void CConnman::ThreadI2PAcceptIncoming ( )
private

Definition at line 2921 of file net.cpp.

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

◆ ThreadMessageHandler()

void CConnman::ThreadMessageHandler ( )
private

Definition at line 2882 of file net.cpp.

Here is the caller graph for this function:

◆ ThreadOpenAddedConnections()

void CConnman::ThreadOpenAddedConnections ( )
private

Definition at line 2812 of file net.cpp.

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

◆ ThreadOpenConnections()

void CConnman::ThreadOpenConnections ( std::vector< std::string >  connect)
private

Definition at line 2398 of file net.cpp.

Here is the call graph for this function:

◆ ThreadSocketHandler()

void CConnman::ThreadSocketHandler ( )
private

Definition at line 2148 of file net.cpp.

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

◆ use_v2transport()

const bool CConnman::use_v2transport ( GetLocalServices() &  NODE_P2P_V2)
Here is the caller graph for this function:

◆ WakeMessageHandler()

void CConnman::WakeMessageHandler ( )

Definition at line 2160 of file net.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ConnmanTestMsg

friend struct ConnmanTestMsg
friend

Definition at line 1651 of file net.h.

Member Data Documentation

◆ !m_added_nodes_mutex [1/2]

bool CConnman::!m_added_nodes_mutex

Definition at line 1109 of file net.h.

◆ !m_added_nodes_mutex [2/2]

void CConnman::!m_added_nodes_mutex
private

Definition at line 1276 of file net.h.

◆ !m_addr_fetches_mutex

bool CConnman::!m_addr_fetches_mutex

Definition at line 1109 of file net.h.

◆ !m_nodes_mutex

void CConnman::!m_nodes_mutex
private

Definition at line 1276 of file net.h.

◆ !m_reconnections_mutex

void CConnman::!m_reconnections_mutex
private

Definition at line 1273 of file net.h.

◆ !m_total_bytes_sent_mutex

void CConnman::!m_total_bytes_sent_mutex
Initial value:
{
Mutex m_total_bytes_sent_mutex
Definition: net.h:1388
#define AssertLockNotHeld(cs)
Definition: sync.h:147

Definition at line 1067 of file net.h.

◆ !m_unused_i2p_sessions_mutex

void CConnman::!m_unused_i2p_sessions_mutex
private

Definition at line 1273 of file net.h.

◆ !mutexMsgProc [1/2]

void CConnman::!mutexMsgProc

Definition at line 1109 of file net.h.

◆ !mutexMsgProc [2/2]

void CConnman::!mutexMsgProc
private

Definition at line 1309 of file net.h.

◆ addrman

AddrMan& CConnman::addrman
private

Definition at line 1412 of file net.h.

◆ condMsgProc

std::condition_variable CConnman::condMsgProc
private

Definition at line 1514 of file net.h.

◆ fAddressesInitialized

bool CConnman::fAddressesInitialized {false}
private

Definition at line 1411 of file net.h.

◆ flagInterruptMsgProc

std::atomic<bool> CConnman::flagInterruptMsgProc {false}
private

Definition at line 1516 of file net.h.

◆ fNetworkActive

std::atomic<bool> CConnman::fNetworkActive {true}
private

Definition at line 1410 of file net.h.

◆ interruptNet

CThreadInterrupt CConnman::interruptNet
private

This is signaled when network activity should cease.

A pointer to it is saved in m_i2p_sam_session, so make sure that the lifetime of interruptNet is not shorter than the lifetime of m_i2p_sam_session.

Definition at line 1524 of file net.h.

◆ m_added_nodes_mutex

Mutex CConnman::m_added_nodes_mutex
mutableprivate

Definition at line 1420 of file net.h.

◆ m_addr_fetches_mutex

Mutex CConnman::m_addr_fetches_mutex
private

Definition at line 1415 of file net.h.

◆ m_addr_response_caches

std::map<uint64_t, CachedAddrResponse> CConnman::m_addr_response_caches
private

Addr responses stored in different caches per (network, local socket) prevent cross-network node identification.

If a node for example is multi-homed under Tor and IPv6, a single cache (or no cache at all) would let an attacker to easily detect that it is the same node by comparing responses. Indexing by local socket prevents leakage when a node has multiple listening addresses on the same network.

The used memory equals to 1000 CAddress records (or around 40 bytes) per distinct Network (up to 5) we have/had an inbound peer from, resulting in at most ~196 KB. Every separate local socket may add up to ~196 KB extra.

Definition at line 1455 of file net.h.

◆ m_anchors

std::vector<CAddress> CConnman::m_anchors
private

Addresses that were saved during the previous clean shutdown.

We'll attempt to make block-relay-only connections to them.

Definition at line 1506 of file net.h.

◆ m_banman [1/2]

CConnman::m_banman = connOptions.m_banman

Definition at line 1079 of file net.h.

◆ m_banman [2/2]

BanMan* CConnman::m_banman
private

Pointer to this node's banman.

May be nullptr - check existence before dereferencing.

Definition at line 1500 of file net.h.

◆ m_client_interface [1/2]

CConnman::m_client_interface = connOptions.uiInterface

Definition at line 1078 of file net.h.

◆ m_client_interface [2/2]

CClientUIInterface* CConnman::m_client_interface
private

Definition at line 1497 of file net.h.

◆ m_i2p_sam_session

std::unique_ptr<i2p::sam::Session> CConnman::m_i2p_sam_session
private

I2P SAM session.

Used to accept incoming and make outgoing I2P connections from a persistent address.

Definition at line 1531 of file net.h.

◆ m_max_addnode

int CConnman::m_max_addnode {MAX_ADDNODE_CONNECTIONS}
private

Definition at line 1491 of file net.h.

◆ m_max_automatic_connections [1/2]

CConnman::m_max_automatic_connections = connOptions.m_max_automatic_connections

Definition at line 1072 of file net.h.

◆ m_max_automatic_connections [2/2]

int CConnman::m_max_automatic_connections
private

Maximum number of automatic connections permitted, excluding manual connections but including inbounds.

May be changed by the user and is potentially limited by the operating system (number of file descriptors).

Definition at line 1477 of file net.h.

◆ m_max_automatic_outbound [1/2]

CConnman::m_max_automatic_outbound = m_max_outbound_full_relay + m_max_outbound_block_relay + m_max_feeler

Definition at line 1075 of file net.h.

◆ m_max_automatic_outbound [2/2]

int CConnman::m_max_automatic_outbound
private

Definition at line 1493 of file net.h.

◆ m_max_feeler

int CConnman::m_max_feeler {MAX_FEELER_CONNECTIONS}
private

Definition at line 1492 of file net.h.

◆ m_max_inbound [1/2]

CConnman::m_max_inbound = std::max(0, m_max_automatic_connections - m_max_automatic_outbound)

Definition at line 1076 of file net.h.

◆ m_max_inbound [2/2]

int CConnman::m_max_inbound
private

Definition at line 1494 of file net.h.

◆ m_max_outbound_block_relay [1/2]

CConnman::m_max_outbound_block_relay = std::min(MAX_BLOCK_RELAY_ONLY_CONNECTIONS, m_max_automatic_connections - m_max_outbound_full_relay)

Definition at line 1074 of file net.h.

◆ m_max_outbound_block_relay [2/2]

int CConnman::m_max_outbound_block_relay
private

Definition at line 1489 of file net.h.

◆ m_max_outbound_full_relay [1/2]

CConnman::m_max_outbound_full_relay = std::min(MAX_OUTBOUND_FULL_RELAY_CONNECTIONS, m_max_automatic_connections)

Definition at line 1073 of file net.h.

◆ m_max_outbound_full_relay [2/2]

int CConnman::m_max_outbound_full_relay
private

Definition at line 1485 of file net.h.

◆ m_msgproc [1/2]

CConnman::m_msgproc = connOptions.m_msgproc

Definition at line 1080 of file net.h.

◆ m_msgproc [2/2]

NetEventsInterface* CConnman::m_msgproc
private

Definition at line 1498 of file net.h.

◆ m_netgroupman

const NetGroupManager& CConnman::m_netgroupman
private

Definition at line 1413 of file net.h.

◆ m_nodes_disconnected

std::list<CNode*> CConnman::m_nodes_disconnected
private

Definition at line 1422 of file net.h.

◆ m_nodes_mutex

RecursiveMutex CConnman::m_nodes_mutex
mutableprivate

Definition at line 1423 of file net.h.

◆ m_onion_binds [1/2]

CConnman::m_onion_binds = connOptions.onion_binds

Definition at line 1099 of file net.h.

◆ m_onion_binds [2/2]

std::vector<CService> CConnman::m_onion_binds
private

A vector of -bind=<address>:<port>=onion arguments each of which is an address and port that are designated for incoming Tor connections.

Definition at line 1555 of file net.h.

◆ m_params

const CChainParams& CConnman::m_params
private

Definition at line 1649 of file net.h.

◆ m_peer_connect_timeout [1/2]

CConnman::m_peer_connect_timeout = std::chrono::seconds{connOptions.m_peer_connect_timeout}

Definition at line 1083 of file net.h.

◆ m_peer_connect_timeout [2/2]

std::chrono::seconds CConnman::m_peer_connect_timeout
private

Definition at line 1398 of file net.h.

◆ m_reconnections_mutex

Mutex CConnman::m_reconnections_mutex
private

Mutex protecting m_reconnections.

Definition at line 1586 of file net.h.

◆ m_start_extra_block_relay_peers

std::atomic_bool CConnman::m_start_extra_block_relay_peers {false}
private

flag for initiating extra block-relay-only peer connections.

this should only be enabled after initial chain sync has occurred, as these connections are intended to be short-lived and low-bandwidth.

Definition at line 1549 of file net.h.

◆ m_total_bytes_sent_mutex

Mutex CConnman::m_total_bytes_sent_mutex
mutableprivate

Definition at line 1388 of file net.h.

◆ m_try_another_outbound_peer

std::atomic_bool CConnman::m_try_another_outbound_peer
private

flag for deciding to connect to an extra outbound peer, in excess of m_max_outbound_full_relay This takes the place of a feeler connection

Definition at line 1543 of file net.h.

◆ m_unused_i2p_sessions_mutex

Mutex CConnman::m_unused_i2p_sessions_mutex
private

Mutex protecting m_i2p_sam_sessions.

Definition at line 1572 of file net.h.

◆ m_use_addrman_outgoing [1/2]

CConnman::m_use_addrman_outgoing = connOptions.m_use_addrman_outgoing

Definition at line 1077 of file net.h.

◆ m_use_addrman_outgoing [2/2]

bool CConnman::m_use_addrman_outgoing
private

Definition at line 1496 of file net.h.

◆ MAX_UNUSED_I2P_SESSIONS_SIZE

constexpr size_t CConnman::MAX_UNUSED_I2P_SESSIONS_SIZE {10}
staticconstexprprivate

Cap on the size of m_unused_i2p_sessions, to ensure it does not unexpectedly use too much memory.

Definition at line 1610 of file net.h.

◆ mutexMsgProc

Mutex CConnman::mutexMsgProc
private

Definition at line 1515 of file net.h.

◆ nLastNodeId

std::atomic<NodeId> CConnman::nLastNodeId {0}
private

Definition at line 1424 of file net.h.

◆ nLocalServices [1/2]

CConnman::nLocalServices = connOptions.nLocalServices

Definition at line 1071 of file net.h.

◆ nLocalServices [2/2]

ServiceFlags CConnman::nLocalServices
private

Services this node offers.

This data is replicated in each Peer instance we create.

This data is not marked const, but after being set it should not change.

See also
Peer::our_services

Definition at line 1467 of file net.h.

◆ nMaxOutboundLimit

CConnman::nMaxOutboundLimit = connOptions.nMaxOutboundLimit

Definition at line 1086 of file net.h.

◆ nPrevNodeCount

unsigned int CConnman::nPrevNodeCount {0}
private

Definition at line 1425 of file net.h.

◆ nReceiveFloodSize [1/2]

CConnman::nReceiveFloodSize = connOptions.nReceiveFloodSize

Definition at line 1082 of file net.h.

◆ nReceiveFloodSize [2/2]

unsigned int CConnman::nReceiveFloodSize {0}
private

Definition at line 1407 of file net.h.

◆ nSeed0

const uint64_t CConnman::nSeed0
private

SipHasher seeds for deterministic randomness.

Definition at line 1509 of file net.h.

◆ nSeed1

const uint64_t CConnman::nSeed1
private

Definition at line 1509 of file net.h.

◆ nSendBufferMaxSize [1/2]

CConnman::nSendBufferMaxSize = connOptions.nSendBufferMaxSize

Definition at line 1081 of file net.h.

◆ nSendBufferMaxSize [2/2]

unsigned int CConnman::nSendBufferMaxSize {0}
private

Definition at line 1406 of file net.h.

◆ nTotalBytesRecv

std::atomic<uint64_t> CConnman::nTotalBytesRecv {0}
private

Definition at line 1389 of file net.h.

◆ semAddnode

std::unique_ptr<CSemaphore> CConnman::semAddnode
private

Definition at line 1470 of file net.h.

◆ semOutbound

std::unique_ptr<CSemaphore> CConnman::semOutbound
private

Definition at line 1469 of file net.h.

◆ threadDNSAddressSeed

std::thread CConnman::threadDNSAddressSeed
private

Definition at line 1533 of file net.h.

◆ threadI2PAcceptIncoming

std::thread CConnman::threadI2PAcceptIncoming
private

Definition at line 1538 of file net.h.

◆ threadMessageHandler

std::thread CConnman::threadMessageHandler
private

Definition at line 1537 of file net.h.

◆ threadOpenAddedConnections

std::thread CConnman::threadOpenAddedConnections
private

Definition at line 1535 of file net.h.

◆ threadOpenConnections

std::thread CConnman::threadOpenConnections
private

Definition at line 1536 of file net.h.

◆ threadSocketHandler

std::thread CConnman::threadSocketHandler
private

Definition at line 1534 of file net.h.

◆ vhListenSocket

std::vector<ListenSocket> CConnman::vhListenSocket
private

Definition at line 1409 of file net.h.

◆ vWhitelistedRangeIncoming [1/2]

CConnman::vWhitelistedRangeIncoming = connOptions.vWhitelistedRangeIncoming

Definition at line 1088 of file net.h.

◆ vWhitelistedRangeIncoming [2/2]

std::vector<NetWhitelistPermissions> CConnman::vWhitelistedRangeIncoming
private

Definition at line 1402 of file net.h.

◆ vWhitelistedRangeOutgoing [1/2]

CConnman::vWhitelistedRangeOutgoing = connOptions.vWhitelistedRangeOutgoing

Definition at line 1089 of file net.h.

◆ vWhitelistedRangeOutgoing [2/2]

std::vector<NetWhitelistPermissions> CConnman::vWhitelistedRangeOutgoing
private

Definition at line 1404 of file net.h.

◆ whitelist_forcerelay [1/2]

CConnman::whitelist_forcerelay = connOptions.whitelist_forcerelay

Definition at line 1100 of file net.h.

◆ whitelist_forcerelay [2/2]

bool CConnman::whitelist_forcerelay
private

flag for adding 'forcerelay' permission to whitelisted inbound and manual peers with default permissions.

Definition at line 1561 of file net.h.

◆ whitelist_relay [1/2]

CConnman::whitelist_relay = connOptions.whitelist_relay

Definition at line 1101 of file net.h.

◆ whitelist_relay [2/2]

bool CConnman::whitelist_relay
private

flag for adding 'relay' permission to whitelisted inbound and manual peers with default permissions.

Definition at line 1567 of file net.h.


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