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

#include <net.h>

Collaboration diagram for CConnman:
[legend]

Classes

struct  ListenSocket
 
struct  Options
 

Public Types

enum  NumConnections { CONNECTIONS_NONE = 0, CONNECTIONS_IN = (1U << 0), CONNECTIONS_OUT = (1U << 1), CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT) }
 

Public Member Functions

void Init (const Options &connOptions)
 
 CConnman (uint64_t seed0, uint64_t seed1)
 
 ~CConnman ()
 
bool Start (CScheduler &scheduler, const Options &options)
 
void Stop () NO_THREAD_SAFETY_ANALYSIS
 
void Interrupt ()
 
bool GetNetworkActive () const
 
bool GetUseAddrmanOutgoing () const
 
void SetNetworkActive (bool active)
 
void OpenNetworkConnection (const CAddress &addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound=nullptr, const char *strDest=nullptr, bool fOneShot=false, bool fFeeler=false, bool manual_connection=false, bool block_relay_only=false)
 
bool CheckIncomingNonce (uint64_t nonce)
 
bool ForNode (NodeId id, std::function< bool(CNode *pnode)> func)
 
void PushMessage (CNode *pnode, CSerializedNetMsg &&msg)
 
template<typename Callable >
void ForEachNode (Callable &&func)
 
template<typename Callable >
void ForEachNode (Callable &&func) const
 
template<typename Callable , typename CallableAfter >
void ForEachNodeThen (Callable &&pre, CallableAfter &&post)
 
template<typename Callable , typename CallableAfter >
void ForEachNodeThen (Callable &&pre, CallableAfter &&post) const
 
size_t GetAddressCount () const
 
void SetServices (const CService &addr, ServiceFlags nServices)
 
void MarkAddressGood (const CAddress &addr)
 
void AddNewAddresses (const std::vector< CAddress > &vAddr, const CAddress &addrFrom, int64_t nTimePenalty=0)
 
std::vector< CAddressGetAddresses ()
 
void SetTryNewOutboundPeer (bool flag)
 
bool GetTryNewOutboundPeer ()
 
int GetExtraOutboundCount ()
 
bool AddNode (const std::string &node)
 
bool RemoveAddedNode (const std::string &node)
 
std::vector< AddedNodeInfoGetAddedNodeInfo ()
 
size_t GetNodeCount (NumConnections num)
 
void GetNodeStats (std::vector< CNodeStats > &vstats)
 
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...
 
void SetMaxOutboundTarget (uint64_t limit)
 set the max outbound target in bytes More...
 
uint64_t GetMaxOutboundTarget ()
 
void SetMaxOutboundTimeframe (uint64_t timeframe)
 set the timeframe for the max outbound target More...
 
uint64_t GetMaxOutboundTimeframe ()
 
bool OutboundTargetReached (bool historicalBlockServingLimit)
 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 ()
 response the bytes left in the current max outbound cycle in case of no limit, it will always response 0 More...
 
uint64_t GetMaxOutboundTimeLeftInCycle ()
 response the time in second left in the current max outbound cycle in case of no limit, it will always response 0 More...
 
uint64_t GetTotalBytesRecv ()
 
uint64_t GetTotalBytesSent ()
 
void SetBestHeight (int height)
 
int GetBestHeight () const
 
CSipHasher GetDeterministicRandomizer (uint64_t id) const
 Get a unique deterministic randomizer. More...
 
unsigned int GetReceiveFloodSize () const
 
void WakeMessageHandler ()
 
int64_t PoissonNextSendInbound (int64_t now, int average_interval_seconds)
 Attempts to obfuscate tx time through exponentially distributed emitting. More...
 
void SetAsmap (std::vector< bool > asmap)
 

Private Member Functions

bool BindListenPort (const CService &bindAddr, std::string &strError, NetPermissionFlags permissions)
 
bool Bind (const CService &addr, unsigned int flags, NetPermissionFlags permissions)
 
bool InitBinds (const std::vector< CService > &binds, const std::vector< NetWhitebindPermissions > &whiteBinds)
 
void ThreadOpenAddedConnections ()
 
void AddOneShot (const std::string &strDest)
 
void ProcessOneShot ()
 
void ThreadOpenConnections (std::vector< std::string > connect)
 
void ThreadMessageHandler ()
 
void AcceptConnection (const ListenSocket &hListenSocket)
 
void DisconnectNodes ()
 
void NotifyNumConnectionsChanged ()
 
void InactivityCheck (CNode *pnode)
 
bool GenerateSelectSet (std::set< SOCKET > &recv_set, std::set< SOCKET > &send_set, std::set< SOCKET > &error_set)
 
void SocketEvents (std::set< SOCKET > &recv_set, std::set< SOCKET > &send_set, std::set< SOCKET > &error_set)
 
void SocketHandler ()
 
void ThreadSocketHandler ()
 
void ThreadDNSAddressSeed ()
 
uint64_t CalculateKeyedNetGroup (const CAddress &ad) const
 
CNodeFindNode (const CNetAddr &ip)
 
CNodeFindNode (const CSubNet &subNet)
 
CNodeFindNode (const std::string &addrName)
 
CNodeFindNode (const CService &addr)
 
bool AttemptToEvictConnection ()
 Try to find a connection to evict when the node is full. More...
 
CNodeConnectNode (CAddress addrConnect, const char *pszDest, bool fCountFailure, bool manual_connection, bool block_relay_only)
 
void AddWhitelistPermissionFlags (NetPermissionFlags &flags, const CNetAddr &addr) const
 
void DeleteNode (CNode *pnode)
 
NodeId GetNewNodeId ()
 
size_t SocketSendData (CNode *pnode) const
 
void DumpAddresses ()
 
void RecordBytesRecv (uint64_t bytes)
 
void RecordBytesSent (uint64_t bytes)
 
uint64_t nTotalBytesRecv GUARDED_BY (cs_totalBytesRecv)
 
uint64_t nTotalBytesSent GUARDED_BY (cs_totalBytesSent)
 
uint64_t nMaxOutboundTotalBytesSentInCycle GUARDED_BY (cs_totalBytesSent)
 
uint64_t nMaxOutboundCycleStartTime GUARDED_BY (cs_totalBytesSent)
 
uint64_t nMaxOutboundLimit GUARDED_BY (cs_totalBytesSent)
 
uint64_t nMaxOutboundTimeframe GUARDED_BY (cs_totalBytesSent)
 
std::deque< std::string > vOneShots GUARDED_BY (cs_vOneShots)
 
std::vector< std::string > vAddedNodes GUARDED_BY (cs_vAddedNodes)
 
std::vector< CNode * > vNodes GUARDED_BY (cs_vNodes)
 

Static Private Member Functions

static bool NodeFullyConnected (const CNode *pnode)
 

Private Attributes

RecursiveMutex cs_totalBytesRecv
 
RecursiveMutex cs_totalBytesSent
 
int64_t m_peer_connect_timeout
 
std::vector< NetWhitelistPermissionsvWhitelistedRange
 
unsigned int nSendBufferMaxSize {0}
 
unsigned int nReceiveFloodSize {0}
 
std::vector< ListenSocketvhListenSocket
 
std::atomic< bool > fNetworkActive {true}
 
bool fAddressesInitialized {false}
 
CAddrMan addrman
 
RecursiveMutex cs_vOneShots
 
RecursiveMutex cs_vAddedNodes
 
std::list< CNode * > vNodesDisconnected
 
RecursiveMutex cs_vNodes
 
std::atomic< NodeIdnLastNodeId {0}
 
unsigned int nPrevNodeCount {0}
 
ServiceFlags nLocalServices
 Services this instance offers. More...
 
std::unique_ptr< CSemaphoresemOutbound
 
std::unique_ptr< CSemaphoresemAddnode
 
int nMaxConnections
 
int m_max_outbound_full_relay
 
int m_max_outbound_block_relay
 
int nMaxAddnode
 
int nMaxFeeler
 
int m_max_outbound
 
bool m_use_addrman_outgoing
 
std::atomic< int > nBestHeight
 
CClientUIInterfaceclientInterface
 
NetEventsInterfacem_msgproc
 
BanManm_banman
 
const uint64_t nSeed0
 SipHasher seeds for deterministic randomness. More...
 
const uint64_t nSeed1
 
bool fMsgProcWake
 flag for waking the message processor. More...
 
std::condition_variable condMsgProc
 
Mutex mutexMsgProc
 
std::atomic< bool > flagInterruptMsgProc {false}
 
CThreadInterrupt interruptNet
 
std::thread threadDNSAddressSeed
 
std::thread threadSocketHandler
 
std::thread threadOpenAddedConnections
 
std::thread threadOpenConnections
 
std::thread threadMessageHandler
 
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< int64_t > m_next_send_inv_to_incoming {0}
 

Friends

struct CConnmanTest
 

Detailed Description

Definition at line 121 of file net.h.

Member Enumeration Documentation

◆ NumConnections

Enumerator
CONNECTIONS_NONE 
CONNECTIONS_IN 
CONNECTIONS_OUT 
CONNECTIONS_ALL 

Definition at line 125 of file net.h.

Constructor & Destructor Documentation

◆ CConnman()

CConnman::CConnman ( uint64_t  seed0,
uint64_t  seed1 
)

Definition at line 2191 of file net.cpp.

Here is the call graph for this function:

◆ ~CConnman()

CConnman::~CConnman ( )

Definition at line 2429 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 927 of file net.cpp.

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

◆ AddNewAddresses()

void CConnman::AddNewAddresses ( const std::vector< CAddress > &  vAddr,
const CAddress addrFrom,
int64_t  nTimePenalty = 0 
)

Definition at line 2450 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 std::string &  node)

Definition at line 2460 of file net.cpp.

◆ AddOneShot()

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

Definition at line 93 of file net.cpp.

Here is the caller graph for this function:

◆ AddWhitelistPermissionFlags()

void CConnman::AddWhitelistPermissionFlags ( NetPermissionFlags flags,
const CNetAddr addr 
) const
private

Definition at line 467 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 837 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 2205 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,
std::string &  strError,
NetPermissionFlags  permissions 
)
private

Definition at line 2058 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 2791 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 330 of file net.cpp.

Here is the caller graph for this function:

◆ ConnectNode()

CNode * CConnman::ConnectNode ( CAddress  addrConnect,
const char *  pszDest,
bool  fCountFailure,
bool  manual_connection,
bool  block_relay_only 
)
private

debug print

Definition at line 356 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 2418 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 std::string &  node)

Definition at line 2510 of file net.cpp.

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

◆ DisconnectNode() [2/4]

bool CConnman::DisconnectNode ( const CSubNet subnet)

Definition at line 2520 of file net.cpp.

Here is the call graph for this function:

◆ DisconnectNode() [3/4]

bool CConnman::DisconnectNode ( const CNetAddr addr)

Definition at line 2533 of file net.cpp.

Here is the call graph for this function:

◆ DisconnectNode() [4/4]

bool CConnman::DisconnectNode ( NodeId  id)

Definition at line 2538 of file net.cpp.

◆ DisconnectNodes()

void CConnman::DisconnectNodes ( )
private

Definition at line 1034 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 1645 of file net.cpp.

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

◆ FindNode() [1/4]

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

Definition at line 286 of file net.cpp.

Here is the caller graph for this function:

◆ FindNode() [2/4]

CNode * CConnman::FindNode ( const CSubNet subNet)
private

Definition at line 297 of file net.cpp.

Here is the call graph for this function:

◆ FindNode() [3/4]

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

Definition at line 308 of file net.cpp.

◆ FindNode() [4/4]

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

Definition at line 319 of file net.cpp.

◆ ForEachNode() [1/2]

template<typename Callable >
void CConnman::ForEachNode ( Callable &&  func)
inline

Definition at line 214 of file net.h.

Here is the caller graph for this function:

◆ ForEachNode() [2/2]

template<typename Callable >
void CConnman::ForEachNode ( Callable &&  func) const
inline

Definition at line 224 of file net.h.

◆ ForEachNodeThen() [1/2]

template<typename Callable , typename CallableAfter >
void CConnman::ForEachNodeThen ( Callable &&  pre,
CallableAfter &&  post 
)
inline

Definition at line 234 of file net.h.

Here is the caller graph for this function:

◆ ForEachNodeThen() [2/2]

template<typename Callable , typename CallableAfter >
void CConnman::ForEachNodeThen ( Callable &&  pre,
CallableAfter &&  post 
) const
inline

Definition at line 245 of file net.h.

◆ ForNode()

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

Definition at line 2757 of file net.cpp.

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

◆ GenerateSelectSet()

bool CConnman::GenerateSelectSet ( std::set< SOCKET > &  recv_set,
std::set< SOCKET > &  send_set,
std::set< SOCKET > &  error_set 
)
private

Definition at line 1143 of file net.cpp.

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

◆ GetAddedNodeInfo()

std::vector< AddedNodeInfo > CConnman::GetAddedNodeInfo ( )

Definition at line 1883 of file net.cpp.

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

◆ GetAddressCount()

size_t CConnman::GetAddressCount ( ) const

Definition at line 2435 of file net.cpp.

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

◆ GetAddresses()

std::vector< CAddress > CConnman::GetAddresses ( )

Definition at line 2455 of file net.cpp.

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

◆ GetBestHeight()

int CConnman::GetBestHeight ( ) const

Definition at line 2668 of file net.cpp.

Here is the caller graph for this function:

◆ GetDeterministicRandomizer()

CSipHasher CConnman::GetDeterministicRandomizer ( uint64_t  id) const

Get a unique deterministic randomizer.

Definition at line 2786 of file net.cpp.

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

◆ GetExtraOutboundCount()

int CConnman::GetExtraOutboundCount ( )

Definition at line 1690 of file net.cpp.

Here is the caller graph for this function:

◆ 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 2658 of file net.cpp.

◆ GetMaxOutboundTarget()

uint64_t CConnman::GetMaxOutboundTarget ( )

Definition at line 2579 of file net.cpp.

◆ GetMaxOutboundTimeframe()

uint64_t CConnman::GetMaxOutboundTimeframe ( )

Definition at line 2585 of file net.cpp.

◆ GetMaxOutboundTimeLeftInCycle()

uint64_t CConnman::GetMaxOutboundTimeLeftInCycle ( )

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

Definition at line 2591 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 203 of file net.h.

Here is the caller graph for this function:

◆ GetNewNodeId()

NodeId CConnman::GetNewNodeId ( )
private

Definition at line 2199 of file net.cpp.

Here is the caller graph for this function:

◆ GetNodeCount()

size_t CConnman::GetNodeCount ( NumConnections  num)

Definition at line 2483 of file net.cpp.

◆ GetNodeStats()

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

Definition at line 2499 of file net.cpp.

◆ GetOutboundTargetBytesLeft()

uint64_t CConnman::GetOutboundTargetBytesLeft ( )

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

Definition at line 2637 of file net.cpp.

◆ GetReceiveFloodSize()

unsigned int CConnman::GetReceiveFloodSize ( ) const

Definition at line 2673 of file net.cpp.

Here is the caller graph for this function:

◆ GetTotalBytesRecv()

uint64_t CConnman::GetTotalBytesRecv ( )

Definition at line 2646 of file net.cpp.

◆ GetTotalBytesSent()

uint64_t CConnman::GetTotalBytesSent ( )

Definition at line 2652 of file net.cpp.

◆ GetTryNewOutboundPeer()

bool CConnman::GetTryNewOutboundPeer ( )

Definition at line 1673 of file net.cpp.

Here is the caller graph for this function:

◆ GetUseAddrmanOutgoing()

bool CConnman::GetUseAddrmanOutgoing ( ) const
inline

Definition at line 204 of file net.h.

Here is the caller graph for this function:

◆ GUARDED_BY() [1/9]

uint64_t nTotalBytesRecv CConnman::GUARDED_BY ( cs_totalBytesRecv  )
inlineprivate

Definition at line 392 of file net.h.

◆ GUARDED_BY() [2/9]

uint64_t nTotalBytesSent CConnman::GUARDED_BY ( cs_totalBytesSent  )
inlineprivate

Definition at line 393 of file net.h.

Here is the call graph for this function:

◆ GUARDED_BY() [3/9]

uint64_t nMaxOutboundTotalBytesSentInCycle CConnman::GUARDED_BY ( cs_totalBytesSent  )
private

◆ GUARDED_BY() [4/9]

uint64_t nMaxOutboundCycleStartTime CConnman::GUARDED_BY ( cs_totalBytesSent  )
private

◆ GUARDED_BY() [5/9]

uint64_t nMaxOutboundLimit CConnman::GUARDED_BY ( cs_totalBytesSent  )
private

◆ GUARDED_BY() [6/9]

uint64_t nMaxOutboundTimeframe CConnman::GUARDED_BY ( cs_totalBytesSent  )
private

◆ GUARDED_BY() [7/9]

std::deque<std::string> vOneShots CConnman::GUARDED_BY ( cs_vOneShots  )
private

◆ GUARDED_BY() [8/9]

std::vector<std::string> vAddedNodes CConnman::GUARDED_BY ( cs_vAddedNodes  )
private

◆ GUARDED_BY() [9/9]

std::vector<CNode*> vNodes CConnman::GUARDED_BY ( cs_vNodes  )
private

◆ InactivityCheck()

void CConnman::InactivityCheck ( CNode pnode)
private

Definition at line 1110 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)
inline

Definition at line 159 of file net.h.

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

◆ InitBinds()

bool CConnman::InitBinds ( const std::vector< CService > &  binds,
const std::vector< NetWhitebindPermissions > &  whiteBinds 
)
private

Definition at line 2218 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 2353 of file net.cpp.

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

◆ MarkAddressGood()

void CConnman::MarkAddressGood ( const CAddress addr)

Definition at line 2445 of file net.cpp.

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

◆ NodeFullyConnected()

bool CConnman::NodeFullyConnected ( const CNode pnode)
staticprivate

Definition at line 2715 of file net.cpp.

◆ NotifyNumConnectionsChanged()

void CConnman::NotifyNumConnectionsChanged ( )
private

Definition at line 1096 of file net.cpp.

Here is the caller graph for this function:

◆ OpenNetworkConnection()

void CConnman::OpenNetworkConnection ( const CAddress addrConnect,
bool  fCountFailure,
CSemaphoreGrant grantOutbound = nullptr,
const char *  strDest = nullptr,
bool  fOneShot = false,
bool  fFeeler = false,
bool  manual_connection = false,
bool  block_relay_only = false 
)

Definition at line 1965 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)

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 2617 of file net.cpp.

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

◆ PoissonNextSendInbound()

int64_t CConnman::PoissonNextSendInbound ( int64_t  now,
int  average_interval_seconds 
)

Attempts to obfuscate tx time through exponentially distributed emitting.

Works assuming that a single interval is used. Variable intervals will result in privacy decrease.

Definition at line 2770 of file net.cpp.

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

◆ ProcessOneShot()

void CConnman::ProcessOneShot ( )
private

Definition at line 1656 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 2720 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 2550 of file net.cpp.

Here is the caller graph for this function:

◆ RecordBytesSent()

void CConnman::RecordBytesSent ( uint64_t  bytes)
private

Definition at line 2556 of file net.cpp.

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

◆ RemoveAddedNode()

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

Definition at line 2471 of file net.cpp.

◆ SetAsmap()

void CConnman::SetAsmap ( std::vector< bool >  asmap)
inline

Definition at line 334 of file net.h.

◆ SetBestHeight()

void CConnman::SetBestHeight ( int  height)

Definition at line 2663 of file net.cpp.

Here is the caller graph for this function:

◆ SetMaxOutboundTarget()

void CConnman::SetMaxOutboundTarget ( uint64_t  limit)

set the max outbound target in bytes

Definition at line 2573 of file net.cpp.

◆ SetMaxOutboundTimeframe()

void CConnman::SetMaxOutboundTimeframe ( uint64_t  timeframe)

set the timeframe for the max outbound target

Definition at line 2605 of file net.cpp.

Here is the call graph for this function:

◆ SetNetworkActive()

void CConnman::SetNetworkActive ( bool  active)

Definition at line 2178 of file net.cpp.

◆ SetServices()

void CConnman::SetServices ( const CService addr,
ServiceFlags  nServices 
)

Definition at line 2440 of file net.cpp.

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

◆ SetTryNewOutboundPeer()

void CConnman::SetTryNewOutboundPeer ( bool  flag)

Definition at line 1678 of file net.cpp.

Here is the caller graph for this function:

◆ SocketEvents()

void CConnman::SocketEvents ( std::set< SOCKET > &  recv_set,
std::set< SOCKET > &  send_set,
std::set< SOCKET > &  error_set 
)
private

Definition at line 1232 of file net.cpp.

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

◆ SocketHandler()

void CConnman::SocketHandler ( )
private

Definition at line 1307 of file net.cpp.

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

◆ SocketSendData()

size_t CConnman::SocketSendData ( CNode pnode) const
private

Definition at line 721 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 2237 of file net.cpp.

Here is the call graph for this function:

◆ Stop()

void CConnman::Stop ( )

Definition at line 2377 of file net.cpp.

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

◆ ThreadDNSAddressSeed()

void CConnman::ThreadDNSAddressSeed ( )
private

Definition at line 1565 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 2004 of file net.cpp.

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

◆ ThreadOpenAddedConnections()

void CConnman::ThreadOpenAddedConnections ( )
private

Definition at line 1937 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 1704 of file net.cpp.

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

◆ ThreadSocketHandler()

void CConnman::ThreadSocketHandler ( )
private

Definition at line 1431 of file net.cpp.

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

◆ WakeMessageHandler()

void CConnman::WakeMessageHandler ( )

Definition at line 1441 of file net.cpp.

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

Friends And Related Function Documentation

◆ CConnmanTest

friend struct CConnmanTest
friend

Definition at line 484 of file net.h.

Member Data Documentation

◆ addrman

CAddrMan CConnman::addrman
private

Definition at line 414 of file net.h.

◆ clientInterface

CClientUIInterface* CConnman::clientInterface
private

Definition at line 455 of file net.h.

◆ condMsgProc

std::condition_variable CConnman::condMsgProc
private

Definition at line 465 of file net.h.

◆ cs_totalBytesRecv

RecursiveMutex CConnman::cs_totalBytesRecv
private

Definition at line 390 of file net.h.

◆ cs_totalBytesSent

RecursiveMutex CConnman::cs_totalBytesSent
private

Definition at line 391 of file net.h.

◆ cs_vAddedNodes

RecursiveMutex CConnman::cs_vAddedNodes
private

Definition at line 418 of file net.h.

◆ cs_vNodes

RecursiveMutex CConnman::cs_vNodes
mutableprivate

Definition at line 421 of file net.h.

◆ cs_vOneShots

RecursiveMutex CConnman::cs_vOneShots
private

Definition at line 416 of file net.h.

◆ fAddressesInitialized

bool CConnman::fAddressesInitialized {false}
private

Definition at line 413 of file net.h.

◆ flagInterruptMsgProc

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

Definition at line 467 of file net.h.

◆ fMsgProcWake

bool CConnman::fMsgProcWake
private

flag for waking the message processor.

Definition at line 463 of file net.h.

◆ fNetworkActive

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

Definition at line 412 of file net.h.

◆ interruptNet

CThreadInterrupt CConnman::interruptNet
private

Definition at line 469 of file net.h.

◆ m_banman

BanMan* CConnman::m_banman
private

Definition at line 457 of file net.h.

◆ m_max_outbound

int CConnman::m_max_outbound
private

Definition at line 452 of file net.h.

◆ m_max_outbound_block_relay

int CConnman::m_max_outbound_block_relay
private

Definition at line 448 of file net.h.

◆ m_max_outbound_full_relay

int CConnman::m_max_outbound_full_relay
private

Definition at line 444 of file net.h.

◆ m_msgproc

NetEventsInterface* CConnman::m_msgproc
private

Definition at line 456 of file net.h.

◆ m_next_send_inv_to_incoming

std::atomic<int64_t> CConnman::m_next_send_inv_to_incoming {0}
private

Definition at line 482 of file net.h.

◆ m_peer_connect_timeout

int64_t CConnman::m_peer_connect_timeout
private

Definition at line 402 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 480 of file net.h.

◆ m_use_addrman_outgoing

bool CConnman::m_use_addrman_outgoing
private

Definition at line 453 of file net.h.

◆ mutexMsgProc

Mutex CConnman::mutexMsgProc
private

Definition at line 466 of file net.h.

◆ nBestHeight

std::atomic<int> CConnman::nBestHeight
private

Definition at line 454 of file net.h.

◆ nLastNodeId

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

Definition at line 422 of file net.h.

◆ nLocalServices

ServiceFlags CConnman::nLocalServices
private

Services this instance offers.

This data is replicated in each CNode instance we create during peer connection (in ConnectNode()) under a member also called nLocalServices.

This data is not marked const, but after being set it should not change. See the note in CNode::nLocalServices documentation.

See also
CNode::nLocalServices

Definition at line 437 of file net.h.

◆ nMaxAddnode

int CConnman::nMaxAddnode
private

Definition at line 450 of file net.h.

◆ nMaxConnections

int CConnman::nMaxConnections
private

Definition at line 441 of file net.h.

◆ nMaxFeeler

int CConnman::nMaxFeeler
private

Definition at line 451 of file net.h.

◆ nPrevNodeCount

unsigned int CConnman::nPrevNodeCount {0}
private

Definition at line 423 of file net.h.

◆ nReceiveFloodSize

unsigned int CConnman::nReceiveFloodSize {0}
private

Definition at line 409 of file net.h.

◆ nSeed0

const uint64_t CConnman::nSeed0
private

SipHasher seeds for deterministic randomness.

Definition at line 460 of file net.h.

◆ nSeed1

const uint64_t CConnman::nSeed1
private

Definition at line 460 of file net.h.

◆ nSendBufferMaxSize

unsigned int CConnman::nSendBufferMaxSize {0}
private

Definition at line 408 of file net.h.

◆ semAddnode

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

Definition at line 440 of file net.h.

◆ semOutbound

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

Definition at line 439 of file net.h.

◆ threadDNSAddressSeed

std::thread CConnman::threadDNSAddressSeed
private

Definition at line 471 of file net.h.

◆ threadMessageHandler

std::thread CConnman::threadMessageHandler
private

Definition at line 475 of file net.h.

◆ threadOpenAddedConnections

std::thread CConnman::threadOpenAddedConnections
private

Definition at line 473 of file net.h.

◆ threadOpenConnections

std::thread CConnman::threadOpenConnections
private

Definition at line 474 of file net.h.

◆ threadSocketHandler

std::thread CConnman::threadSocketHandler
private

Definition at line 472 of file net.h.

◆ vhListenSocket

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

Definition at line 411 of file net.h.

◆ vNodesDisconnected

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

Definition at line 420 of file net.h.

◆ vWhitelistedRange

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

Definition at line 406 of file net.h.


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