Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <net.h>
Classes | |
struct | CAllNodes |
struct | CFullyConnectedOnly |
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) } |
enum | SocketEventsMode { SOCKETEVENTS_SELECT = 0, SOCKETEVENTS_POLL = 1, SOCKETEVENTS_EPOLL = 2 } |
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 () |
void | Interrupt () |
bool | GetNetworkActive () const |
void | SetNetworkActive (bool active) |
SocketEventsMode | GetSocketEventsMode () const |
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 fConnectToMasternode=false, bool fMasternodeProbe=false) |
void | OpenMasternodeConnection (const CAddress &addrConnect, bool probe=false) |
bool | CheckIncomingNonce (uint64_t nonce) |
bool | ForNode (NodeId id, std::function< bool(const CNode *pnode)> cond, std::function< bool(CNode *pnode)> func) |
bool | ForNode (const CService &addr, std::function< bool(const CNode *pnode)> cond, std::function< bool(CNode *pnode)> func) |
template<typename Callable > | |
bool | ForNode (const CService &addr, Callable &&func) |
template<typename Callable > | |
bool | ForNode (NodeId id, Callable &&func) |
bool | IsConnected (const CService &addr, std::function< bool(const CNode *pnode)> cond) |
bool | IsMasternodeOrDisconnectRequested (const CService &addr) |
void | PushMessage (CNode *pnode, CSerializedNetMsg &&msg) |
template<typename Condition , typename Callable > | |
bool | ForEachNodeContinueIf (const Condition &cond, Callable &&func) |
template<typename Callable > | |
bool | ForEachNodeContinueIf (Callable &&func) |
template<typename Condition , typename Callable > | |
bool | ForEachNodeContinueIf (const Condition &cond, Callable &&func) const |
template<typename Callable > | |
bool | ForEachNodeContinueIf (Callable &&func) const |
template<typename Condition , typename Callable > | |
void | ForEachNode (const Condition &cond, Callable &&func) |
template<typename Callable > | |
void | ForEachNode (Callable &&func) |
template<typename Condition , typename Callable > | |
void | ForEachNode (const Condition &cond, Callable &&func) const |
template<typename Callable > | |
void | ForEachNode (Callable &&func) const |
template<typename Condition , typename Callable , typename CallableAfter > | |
void | ForEachNodeThen (const Condition &cond, Callable &&pre, CallableAfter &&post) |
template<typename Callable , typename CallableAfter > | |
void | ForEachNodeThen (Callable &&pre, CallableAfter &&post) |
template<typename Condition , typename Callable , typename CallableAfter > | |
void | ForEachNodeThen (const Condition &cond, Callable &&pre, CallableAfter &&post) const |
template<typename Callable , typename CallableAfter > | |
void | ForEachNodeThen (Callable &&pre, CallableAfter &&post) const |
std::vector< CNode * > | CopyNodeVector (std::function< bool(const CNode *pnode)> cond) |
std::vector< CNode * > | CopyNodeVector () |
void | ReleaseNodeVector (const std::vector< CNode *> &vecNodes) |
void | RelayTransaction (const CTransaction &tx) |
void | RelayInv (CInv &inv, const int minProtoVersion=MIN_PEER_PROTO_VERSION, bool fAllowMasternodeConnections=false) |
void | RelayInvFiltered (CInv &inv, const CTransaction &relatedTx, const int minProtoVersion=MIN_PEER_PROTO_VERSION, bool fAllowMasternodeConnections=false) |
void | RelayInvFiltered (CInv &inv, const uint256 &relatedTxHash, const int minProtoVersion=MIN_PEER_PROTO_VERSION, bool fAllowMasternodeConnections=false) |
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< CAddress > | GetAddresses () |
void | Ban (const CNetAddr &netAddr, const BanReason &reason, int64_t bantimeoffset=0, bool sinceUnixEpoch=false) |
void | Ban (const CSubNet &subNet, const BanReason &reason, int64_t bantimeoffset=0, bool sinceUnixEpoch=false) |
void | ClearBanned () |
bool | IsBanned (CNetAddr ip) |
bool | IsBanned (CSubNet subnet) |
bool | Unban (const CNetAddr &ip) |
bool | Unban (const CSubNet &ip) |
void | GetBanned (banmap_t &banmap) |
void | SetBanned (const banmap_t &banmap) |
void | SetTryNewOutboundPeer (bool flag) |
bool | GetTryNewOutboundPeer () |
int | GetExtraOutboundCount () |
bool | AddNode (const std::string &node) |
bool | RemoveAddedNode (const std::string &node) |
std::vector< AddedNodeInfo > | GetAddedNodeInfo () |
bool | AddPendingMasternode (const uint256 &proTxHash) |
void | SetMasternodeQuorumNodes (Consensus::LLMQType llmqType, const uint256 &quorumHash, const std::set< uint256 > &proTxHashes) |
bool | HasMasternodeQuorumNodes (Consensus::LLMQType llmqType, const uint256 &quorumHash) |
std::set< uint256 > | GetMasternodeQuorums (Consensus::LLMQType llmqType) |
std::set< NodeId > | GetMasternodeQuorumNodes (Consensus::LLMQType llmqType, const uint256 &quorumHash) const |
void | RemoveMasternodeQuorumNodes (Consensus::LLMQType llmqType, const uint256 &quorumHash) |
bool | IsMasternodeQuorumNode (const CNode *pnode) |
void | AddPendingProbeConnections (const std::set< uint256 > &proTxHashes) |
size_t | GetNodeCount (NumConnections num) |
size_t | GetMaxOutboundNodeCount () |
void | GetNodeStats (std::vector< CNodeStats > &vstats) |
bool | DisconnectNode (const std::string &node) |
bool | DisconnectNode (NodeId id) |
ServiceFlags | GetLocalServices () const |
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 More... | |
uint64_t | GetOutboundTargetBytesLeft () |
response the bytes left in the current max outbound cycle More... | |
uint64_t | GetMaxOutboundTimeLeftInCycle () |
response the time in second left in the current max outbound cycle 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 () |
void | WakeSelect () |
int64_t | PoissonNextSendInbound (int64_t now, int average_interval_seconds) |
Attempts to obfuscate tx time through exponentially distributed emitting. More... | |
Static Public Attributes | |
static constexpr const CFullyConnectedOnly | FullyConnectedOnly {} |
static constexpr const CAllNodes | AllNodes {} |
Private Member Functions | |
bool | BindListenPort (const CService &bindAddr, std::string &strError, bool fWhitelisted=false) |
bool | Bind (const CService &addr, unsigned int flags) |
bool | InitBinds (const std::vector< CService > &binds, const std::vector< CService > &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 | SocketEventsSelect (std::set< SOCKET > &recv_set, std::set< SOCKET > &send_set, std::set< SOCKET > &error_set, bool fOnlyPoll) |
void | SocketEvents (std::set< SOCKET > &recv_set, std::set< SOCKET > &send_set, std::set< SOCKET > &error_set, bool fOnlyPoll) |
void | SocketHandler () |
void | ThreadSocketHandler () |
void | ThreadDNSAddressSeed () |
void | ThreadOpenMasternodeConnections () |
uint64_t | CalculateKeyedNetGroup (const CAddress &ad) const |
CNode * | FindNode (const CNetAddr &ip, bool fExcludeDisconnecting=true) |
CNode * | FindNode (const CSubNet &subNet, bool fExcludeDisconnecting=true) |
CNode * | FindNode (const std::string &addrName, bool fExcludeDisconnecting=true) |
CNode * | FindNode (const CService &addr, bool fExcludeDisconnecting=true) |
bool | AttemptToEvictConnection () |
Try to find a connection to evict when the node is full. More... | |
CNode * | ConnectNode (CAddress addrConnect, const char *pszDest=nullptr, bool fCountFailure=false) |
bool | IsWhitelistedRange (const CNetAddr &addr) |
void | DeleteNode (CNode *pnode) |
NodeId | GetNewNodeId () |
size_t | SocketSendData (CNode *pnode) |
size_t | SocketRecvData (CNode *pnode) |
bool | BannedSetIsDirty () |
check is the banlist has unwritten changes More... | |
void | SetBannedSetDirty (bool dirty=true) |
set the "dirty" flag for the banlist More... | |
void | SweepBanned () |
clean unused entries (if bantime has expired) More... | |
void | DumpAddresses () |
void | DumpData () |
void | DumpBanlist () |
void | RecordBytesRecv (uint64_t bytes) |
void | RecordBytesSent (uint64_t bytes) |
void | RegisterEvents (CNode *pnode) |
void | UnregisterEvents (CNode *pnode) |
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) |
banmap_t setBanned | GUARDED_BY (cs_setBanned) |
bool setBannedIsDirty | GUARDED_BY (cs_setBanned) |
std::deque< std::string > vOneShots | GUARDED_BY (cs_vOneShots) |
std::vector< std::string > vAddedNodes | GUARDED_BY (cs_vAddedNodes) |
std::unordered_map< NodeId, CNode * > mapReceivableNodes | GUARDED_BY (cs_vNodes) |
Protected by cs_vNodes. More... | |
std::unordered_map< NodeId, CNode * > mapSendableNodes | GUARDED_BY (cs_vNodes) |
std::unordered_map< NodeId, CNode * > mapNodesWithDataToSend | GUARDED_BY (cs_mapNodesWithDataToSend) |
Protected by cs_mapNodesWithDataToSend. More... | |
Static Private Member Functions | |
static bool | NodeFullyConnected (const CNode *pnode) |
Friends | |
class | CNode |
struct | CConnmanTest |
Detailed Description
Member Enumeration Documentation
◆ NumConnections
◆ SocketEventsMode
Constructor & Destructor Documentation
◆ CConnman()
CConnman::CConnman | ( | uint64_t | seed0, |
uint64_t | seed1 | ||
) |
Definition at line 2903 of file net.cpp.
References fAddressesInitialized, flagInterruptMsgProc, fNetworkActive, Init(), nLastNodeId, nPrevNodeCount, nReceiveFloodSize, nSendBufferMaxSize, and SetTryNewOutboundPeer().
◆ ~CConnman()
CConnman::~CConnman | ( | ) |
Definition at line 3251 of file net.cpp.
References Interrupt(), and Stop().
Member Function Documentation
◆ AcceptConnection()
|
private |
Definition at line 1167 of file net.cpp.
References CNode::AddRef(), AttemptToEvictConnection(), CalculateKeyedNetGroup(), CloseSocket(), CNode, cs_vNodes, CSipHasher::Finalize(), fLogIPs, fMasternodeMode, fNetworkActive, CNode::fWhitelisted, GetBestHeight(), GetBindAddress(), GetDeterministicRandomizer(), CNode::GetId(), GetNewNodeId(), NetEventsInterface::InitializeNode(), INVALID_SOCKET, IsBanned(), IsSelectableSocket(), CMasternodeSync::IsSynced(), IsWhitelistedRange(), LOCK, LogPrint, LogPrintf, m_msgproc, mapSocketToNode, masternodeSync, BCLog::NET, BCLog::NET_NETCONN, NetworkErrorString(), nLocalServices, nMaxConnections, nMaxFeeler, nMaxOutbound, RANDOMIZER_ID_LOCALHOSTNONCE, RegisterEvents(), CService::SetSockAddr(), SetSocketNoDelay(), CConnman::ListenSocket::socket, strprintf, CService::ToString(), vNodes, WakeSelect(), CConnman::ListenSocket::whitelisted, CSipHasher::Write(), WSAEWOULDBLOCK, and WSAGetLastError.
Referenced by SocketHandler().
◆ AddNewAddresses()
void CConnman::AddNewAddresses | ( | const std::vector< CAddress > & | vAddr, |
const CAddress & | addrFrom, | ||
int64_t | nTimePenalty = 0 |
||
) |
Definition at line 3272 of file net.cpp.
References CAddrMan::Add(), and addrman.
Referenced by ProcessMessage().
◆ AddNode()
bool CConnman::AddNode | ( | const std::string & | node | ) |
Definition at line 3282 of file net.cpp.
References cs_vAddedNodes, and LOCK.
◆ AddOneShot()
|
private |
Definition at line 120 of file net.cpp.
References cs_vOneShots, and LOCK.
Referenced by Start(), and ThreadDNSAddressSeed().
◆ AddPendingMasternode()
bool CConnman::AddPendingMasternode | ( | const uint256 & | proTxHash | ) |
Definition at line 3305 of file net.cpp.
References cs_vPendingMasternodes, LOCK, and vPendingMasternodes.
Referenced by CPrivateSendClientSession::JoinExistingQueue(), and CPrivateSendClientSession::StartNewQueue().
◆ AddPendingProbeConnections()
void CConnman::AddPendingProbeConnections | ( | const std::set< uint256 > & | proTxHashes | ) |
Definition at line 3402 of file net.cpp.
References cs_vPendingMasternodes, LOCK, and masternodePendingProbes.
◆ 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 1073 of file net.cpp.
References CompareNetGroupKeyed(), CompareNodeBlockTime(), CompareNodeTXTime(), cs_vNodes, EraseLastKElements(), fMasternodeMode, GetSystemTimeInSeconds(), HasAllDesirableServiceFlags(), INBOUND_EVICTION_PROTECTION_TIME, LOCK, NodeEvictionCandidate::nTimeConnected, ReverseCompareNodeMinPingTime(), ReverseCompareNodeTimeConnected(), and vNodes.
Referenced by AcceptConnection().
◆ Ban() [1/2]
void CConnman::Ban | ( | const CNetAddr & | netAddr, |
const BanReason & | reason, | ||
int64_t | bantimeoffset = 0 , |
||
bool | sinceUnixEpoch = false |
||
) |
Definition at line 605 of file net.cpp.
Referenced by SendRejectsAndCheckIfBanned().
◆ Ban() [2/2]
void CConnman::Ban | ( | const CSubNet & | subNet, |
const BanReason & | reason, | ||
int64_t | bantimeoffset = 0 , |
||
bool | sinceUnixEpoch = false |
||
) |
Definition at line 610 of file net.cpp.
References CClientUIInterface::BannedListChanged, CBanEntry::banReason, BanReasonManuallyAdded, clientInterface, cs_setBanned, cs_vNodes, DEFAULT_MISBEHAVING_BANTIME, DumpBanlist(), gArgs, ArgsManager::GetArg(), GetTime(), LOCK, CSubNet::Match(), CBanEntry::nBanUntil, and vNodes.
◆ BannedSetIsDirty()
|
private |
check is the banlist has unwritten changes
Definition at line 703 of file net.cpp.
References cs_setBanned, and LOCK.
Referenced by DumpBanlist().
◆ Bind()
|
private |
Definition at line 2927 of file net.cpp.
References BF_EXPLICIT, BF_REPORT_ERROR, BF_WHITELIST, BindListenPort(), clientInterface, flags, IsLimited(), CClientUIInterface::MSG_ERROR, and CClientUIInterface::ThreadSafeMessageBox.
Referenced by InitBinds().
◆ BindListenPort()
|
private |
Definition at line 2752 of file net.cpp.
References _(), AddLocal(), CloseSocket(), CreateSocket(), fDiscover, CService::GetSockAddr(), INVALID_SOCKET, CNetAddr::IsIPv6(), CNetAddr::IsRoutable(), LOCAL_BIND, LogPrintf, NetworkErrorString(), SOCKET_ERROR, SOCKETEVENTS_EPOLL, socketEventsMode, strprintf, CService::ToString(), vhListenSocket, WSAEADDRINUSE, and WSAGetLastError.
Referenced by Bind().
◆ CalculateKeyedNetGroup()
|
private |
Definition at line 3863 of file net.cpp.
References GetDeterministicRandomizer(), CNetAddr::GetGroup(), RANDOMIZER_ID_NETGROUP, and CSipHasher::Write().
Referenced by AcceptConnection(), and ConnectNode().
◆ CheckIncomingNonce()
bool CConnman::CheckIncomingNonce | ( | uint64_t | nonce | ) |
◆ ClearBanned()
void CConnman::ClearBanned | ( | ) |
Definition at line 565 of file net.cpp.
References CClientUIInterface::BannedListChanged, clientInterface, cs_setBanned, DumpBanlist(), and LOCK.
◆ ConnectNode()
|
private |
debug print
Definition at line 412 of file net.cpp.
References CNode::AddRef(), addrman, CChainParams::AllowMultiplePorts(), CAddrMan::Attempt(), CalculateKeyedNetGroup(), CloseSocket(), CNode, ConnectSocketDirectly(), ConnectThroughProxy(), CreateSocket(), cs_vNodes, CSipHasher::Finalize(), FindNode(), fLogIPs, fNameLookup, GetAdjustedTime(), GetBestHeight(), GetBindAddress(), CChainParams::GetDefaultPort(), GetDeterministicRandomizer(), GetListenPort(), GetNameProxy(), CNetAddr::GetNetwork(), GetNewNodeId(), CService::GetPort(), GetProxy(), GetRand(), HaveNameProxy(), INVALID_SOCKET, IsLocal(), CNetAddr::IsValid(), LOCK, LogPrint, LogPrintf, Lookup(), CNode::MaybeSetAddrName(), nConnectTimeout, BCLog::NET, nLocalServices, NODE_NONE, CAddress::nTime, Params(), proxyType::proxy, RANDOMIZER_ID_LOCALHOSTNONCE, SplitHostPort(), CService::ToString(), CNetAddr::ToStringIP(), and CSipHasher::Write().
Referenced by OpenNetworkConnection().
◆ CopyNodeVector() [1/2]
Definition at line 3830 of file net.cpp.
References CNode::AddRef(), cs_vNodes, LOCK, and vNodes.
Referenced by CMasternodeSync::ProcessTick(), and CGovernanceManager::RequestOrphanObjects().
◆ CopyNodeVector() [2/2]
std::vector< CNode * > CConnman::CopyNodeVector | ( | ) |
◆ DeleteNode()
|
private |
Definition at line 3240 of file net.cpp.
References CNode::addr, addrman, CAddrMan::Connected(), NetEventsInterface::FinalizeNode(), CNode::GetId(), and m_msgproc.
Referenced by DisconnectNodes(), and Stop().
◆ DisconnectNode() [1/2]
bool CConnman::DisconnectNode | ( | const std::string & | node | ) |
Definition at line 3444 of file net.cpp.
References cs_vNodes, FindNode(), and LOCK.
◆ DisconnectNode() [2/2]
bool CConnman::DisconnectNode | ( | NodeId | id | ) |
◆ DisconnectNodes()
|
private |
Definition at line 1282 of file net.cpp.
References CNode::addr, CNode::CloseSocketDisconnect(), CNode::cs_hSocket, CNode::cs_inventory, cs_vNodes, CNode::cs_vSend, DeleteNode(), CNode::fDisconnect, CNode::fInbound, fLogIPs, CNode::fMasternode, fNetworkActive, CNode::fOtherSideDisconnected, CNode::fSocketShutdown, CNode::GetId(), CNode::GetRefCount(), GetTimeMillis(), CNode::grantOutbound, INVALID_SOCKET, LOCK, LogPrint, LogPrintf, CNode::nDisconnectLingerTime, BCLog::NET, CNode::nSendMsgSize, CSemaphoreGrant::Release(), CNode::Release(), SD_SEND, CService::ToString(), TRY_LOCK, vNodes, and vNodesDisconnected.
Referenced by ThreadSocketHandler().
◆ DumpAddresses()
|
private |
Definition at line 2152 of file net.cpp.
References addrman, GetTimeMillis(), LogPrint, BCLog::NET, CAddrMan::size(), and CAddrDB::Write().
Referenced by DumpData(), and Start().
◆ DumpBanlist()
|
private |
Definition at line 515 of file net.cpp.
References BannedSetIsDirty(), GetBanned(), GetTimeMillis(), LogPrint, BCLog::NET, SetBannedSetDirty(), SweepBanned(), and CBanDB::Write().
Referenced by Ban(), ClearBanned(), DumpData(), Start(), and Unban().
◆ DumpData()
|
private |
Definition at line 2163 of file net.cpp.
References DumpAddresses(), and DumpBanlist().
◆ FindNode() [1/4]
Definition at line 330 of file net.cpp.
References cs_vNodes, LOCK, and vNodes.
Referenced by ConnectNode(), DisconnectNode(), and OpenNetworkConnection().
◆ FindNode() [2/4]
◆ FindNode() [3/4]
◆ FindNode() [4/4]
◆ ForEachNode() [1/4]
|
inline |
Definition at line 288 of file net.h.
References cs_vNodes, LOCK, and vNodes.
Referenced by PeerLogicValidation::EvictExtraOutboundPeers(), ForEachNode(), PeerLogicValidation::NewPoWValidBlock(), CMasternodeUtils::ProcessMasternodeConnections(), CMNAuth::ProcessMessage(), CPrivateSendQueue::Relay(), CMasternodeSync::SwitchToNextAsset(), ThreadOpenMasternodeConnections(), ThreadSocketHandler(), and PeerLogicValidation::UpdatedBlockTip().
◆ ForEachNode() [2/4]
|
inline |
Definition at line 298 of file net.h.
References ForEachNode(), and FullyConnectedOnly.
◆ ForEachNode() [3/4]
|
inline |
◆ ForEachNode() [4/4]
|
inline |
Definition at line 314 of file net.h.
References ForEachNode(), and FullyConnectedOnly.
◆ ForEachNodeContinueIf() [1/4]
|
inline |
◆ ForEachNodeContinueIf() [2/4]
|
inline |
Definition at line 265 of file net.h.
References ForEachNodeContinueIf(), and FullyConnectedOnly.
◆ ForEachNodeContinueIf() [3/4]
|
inline |
◆ ForEachNodeContinueIf() [4/4]
|
inline |
Definition at line 282 of file net.h.
References ForEachNodeContinueIf(), and FullyConnectedOnly.
◆ ForEachNodeThen() [1/4]
|
inline |
Definition at line 320 of file net.h.
References cs_vNodes, LOCK, and vNodes.
Referenced by ForEachNodeThen(), and RelayAddress().
◆ ForEachNodeThen() [2/4]
|
inline |
Definition at line 331 of file net.h.
References ForEachNodeThen(), and FullyConnectedOnly.
◆ ForEachNodeThen() [3/4]
|
inline |
◆ ForEachNodeThen() [4/4]
|
inline |
Definition at line 348 of file net.h.
References ForEachNodeThen(), and FullyConnectedOnly.
◆ ForNode() [1/4]
bool CConnman::ForNode | ( | NodeId | id, |
std::function< bool(const CNode *pnode)> | cond, | ||
std::function< bool(CNode *pnode)> | func | ||
) |
Definition at line 3795 of file net.cpp.
References cs_vNodes, CNode::GetId(), LOCK, and vNodes.
Referenced by PeerLogicValidation::EvictExtraOutboundPeers(), ForNode(), IsConnected(), IsMasternodeOrDisconnectRequested(), CPrivateSendClientSession::ProcessPendingDsaRequest(), CPrivateSendServer::RelayCompletedTransaction(), CPrivateSendServer::RelayFinalTransaction(), CPrivateSendClientSession::RelayIn(), CPrivateSendServer::RelayStatus(), and ThreadOpenMasternodeConnections().
◆ ForNode() [2/4]
◆ ForNode() [3/4]
|
inline |
Definition at line 231 of file net.h.
References ForNode(), and FullyConnectedOnly.
◆ ForNode() [4/4]
|
inline |
Definition at line 237 of file net.h.
References ForNode(), and FullyConnectedOnly.
◆ GenerateSelectSet()
|
private |
Definition at line 1442 of file net.cpp.
References cs_vNodes, INVALID_SOCKET, LOCK, vhListenSocket, vNodes, and wakeupPipe.
Referenced by SocketEventsSelect().
◆ GetAddedNodeInfo()
std::vector< AddedNodeInfo > CConnman::GetAddedNodeInfo | ( | ) |
Definition at line 2405 of file net.cpp.
References immer::copy(), cs_vAddedNodes, cs_vNodes, CChainParams::GetDefaultPort(), CNetAddr::IsValid(), LOCK, LookupNumeric(), Params(), and vNodes.
Referenced by ThreadOpenAddedConnections().
◆ GetAddressCount()
size_t CConnman::GetAddressCount | ( | ) | const |
Definition at line 3257 of file net.cpp.
References addrman, and CAddrMan::size().
Referenced by ProcessMessage().
◆ GetAddresses()
std::vector< CAddress > CConnman::GetAddresses | ( | ) |
Definition at line 3277 of file net.cpp.
References addrman, and CAddrMan::GetAddr().
Referenced by ProcessMessage().
◆ GetBanned()
void CConnman::GetBanned | ( | banmap_t & | banmap | ) |
Definition at line 660 of file net.cpp.
References cs_setBanned, LOCK, and SweepBanned().
Referenced by DumpBanlist().
◆ GetBestHeight()
int CConnman::GetBestHeight | ( | ) | const |
Definition at line 3638 of file net.cpp.
References nBestHeight.
Referenced by AcceptConnection(), and ConnectNode().
◆ GetDeterministicRandomizer()
CSipHasher CConnman::GetDeterministicRandomizer | ( | uint64_t | id | ) | const |
Get a unique deterministic randomizer.
Definition at line 3858 of file net.cpp.
References nSeed0, nSeed1, and CSipHasher::Write().
Referenced by AcceptConnection(), CalculateKeyedNetGroup(), ConnectNode(), and RelayAddress().
◆ GetExtraOutboundCount()
int CConnman::GetExtraOutboundCount | ( | ) |
Definition at line 2203 of file net.cpp.
References cs_vNodes, LOCK, nMaxOutbound, and vNodes.
Referenced by PeerLogicValidation::EvictExtraOutboundPeers().
◆ GetLocalServices()
ServiceFlags CConnman::GetLocalServices | ( | ) | const |
Definition at line 3628 of file net.cpp.
References nLocalServices.
◆ GetMasternodeQuorumNodes()
std::set< NodeId > CConnman::GetMasternodeQuorumNodes | ( | Consensus::LLMQType | llmqType, |
const uint256 & | quorumHash | ||
) | const |
Definition at line 3344 of file net.cpp.
References cs_vNodes, cs_vPendingMasternodes, LOCK2, masternodeQuorumNodes, and vNodes.
Referenced by llmq::CSigSharesManager::ProcessSigShare().
◆ GetMasternodeQuorums()
std::set< uint256 > CConnman::GetMasternodeQuorums | ( | Consensus::LLMQType | llmqType | ) |
Definition at line 3331 of file net.cpp.
References cs_vPendingMasternodes, LOCK, and masternodeQuorumNodes.
◆ GetMaxOutboundNodeCount()
size_t CConnman::GetMaxOutboundNodeCount | ( | ) |
Definition at line 3425 of file net.cpp.
References nMaxOutbound.
Referenced by CMasternodeUtils::ProcessMasternodeConnections().
◆ GetMaxOutboundTarget()
uint64_t CConnman::GetMaxOutboundTarget | ( | ) |
Definition at line 3549 of file net.cpp.
References cs_totalBytesSent, and LOCK.
◆ GetMaxOutboundTimeframe()
uint64_t CConnman::GetMaxOutboundTimeframe | ( | ) |
Definition at line 3555 of file net.cpp.
References cs_totalBytesSent, and LOCK.
◆ GetMaxOutboundTimeLeftInCycle()
uint64_t CConnman::GetMaxOutboundTimeLeftInCycle | ( | ) |
response the time in second left in the current max outbound cycle
Definition at line 3561 of file net.cpp.
References cs_totalBytesSent, GetTime(), and LOCK.
Referenced by OutboundTargetReached().
◆ GetNetworkActive()
|
inline |
Definition at line 206 of file net.h.
References fNetworkActive.
◆ GetNewNodeId()
|
private |
Definition at line 2921 of file net.cpp.
References nLastNodeId.
Referenced by AcceptConnection(), and ConnectNode().
◆ GetNodeCount()
size_t CConnman::GetNodeCount | ( | NumConnections | num | ) |
Definition at line 3408 of file net.cpp.
References CONNECTIONS_IN, CONNECTIONS_OUT, cs_vNodes, flags, LOCK, and vNodes.
◆ GetNodeStats()
void CConnman::GetNodeStats | ( | std::vector< CNodeStats > & | vstats | ) |
◆ GetOutboundTargetBytesLeft()
uint64_t CConnman::GetOutboundTargetBytesLeft | ( | ) |
response the bytes left in the current max outbound cycle
Definition at line 3607 of file net.cpp.
References cs_totalBytesSent, and LOCK.
◆ GetReceiveFloodSize()
unsigned int CConnman::GetReceiveFloodSize | ( | ) | const |
Definition at line 3643 of file net.cpp.
References nReceiveFloodSize.
Referenced by PeerLogicValidation::ProcessMessages().
◆ GetSocketEventsMode()
|
inline |
Definition at line 208 of file net.h.
References socketEventsMode.
◆ GetTotalBytesRecv()
uint64_t CConnman::GetTotalBytesRecv | ( | ) |
Definition at line 3616 of file net.cpp.
References cs_totalBytesRecv, and LOCK.
◆ GetTotalBytesSent()
uint64_t CConnman::GetTotalBytesSent | ( | ) |
Definition at line 3622 of file net.cpp.
References cs_totalBytesSent, and LOCK.
◆ GetTryNewOutboundPeer()
bool CConnman::GetTryNewOutboundPeer | ( | ) |
Definition at line 2186 of file net.cpp.
References m_try_another_outbound_peer.
Referenced by PeerLogicValidation::CheckForStaleTipAndEvictPeers(), and ThreadOpenConnections().
◆ GUARDED_BY() [1/13]
|
private |
◆ GUARDED_BY() [2/13]
|
private |
◆ GUARDED_BY() [3/13]
|
private |
◆ GUARDED_BY() [4/13]
|
private |
◆ GUARDED_BY() [5/13]
|
private |
◆ GUARDED_BY() [6/13]
|
private |
◆ GUARDED_BY() [7/13]
|
private |
◆ GUARDED_BY() [8/13]
|
private |
◆ GUARDED_BY() [9/13]
|
private |
◆ GUARDED_BY() [10/13]
|
private |
◆ GUARDED_BY() [11/13]
Protected by cs_vNodes.
◆ GUARDED_BY() [12/13]
◆ GUARDED_BY() [13/13]
|
private |
Protected by cs_mapNodesWithDataToSend.
◆ HasMasternodeQuorumNodes()
bool CConnman::HasMasternodeQuorumNodes | ( | Consensus::LLMQType | llmqType, |
const uint256 & | quorumHash | ||
) |
Definition at line 3325 of file net.cpp.
References cs_vPendingMasternodes, LOCK, and masternodeQuorumNodes.
◆ InactivityCheck()
|
private |
Definition at line 1409 of file net.cpp.
References BIP0031_VERSION, CNode::fDisconnect, CNode::fSuccessfullyConnected, CNode::GetId(), GetSystemTimeInSeconds(), GetTimeMicros(), LogPrint, LogPrintf, BCLog::NET, CNode::nLastRecv, CNode::nLastSend, CNode::nPingNonceSent, CNode::nPingUsecStart, CNode::nTimeConnected, CNode::nVersion, and TIMEOUT_INTERVAL.
Referenced by ThreadSocketHandler().
◆ Init()
|
inline |
Definition at line 177 of file net.h.
References clientInterface, cs_totalBytesSent, cs_vAddedNodes, LOCK, CConnman::Options::m_added_nodes, CConnman::Options::m_msgproc, m_msgproc, CConnman::Options::nBestHeight, nBestHeight, CConnman::Options::nLocalServices, nLocalServices, CConnman::Options::nMaxAddnode, nMaxAddnode, CConnman::Options::nMaxConnections, nMaxConnections, CConnman::Options::nMaxFeeler, nMaxFeeler, CConnman::Options::nMaxOutbound, nMaxOutbound, CConnman::Options::nMaxOutboundLimit, CConnman::Options::nMaxOutboundTimeframe, CConnman::Options::nReceiveFloodSize, nReceiveFloodSize, CConnman::Options::nSendBufferMaxSize, nSendBufferMaxSize, CConnman::Options::socketEventsMode, socketEventsMode, CConnman::Options::uiInterface, CConnman::Options::vWhitelistedRange, and vWhitelistedRange.
Referenced by CConnman(), and Start().
◆ InitBinds()
|
private |
Definition at line 2940 of file net.cpp.
References BF_EXPLICIT, BF_NONE, BF_REPORT_ERROR, BF_WHITELIST, Bind(), and GetListenPort().
Referenced by Start().
◆ Interrupt()
void CConnman::Interrupt | ( | ) |
Definition at line 3141 of file net.cpp.
References condMsgProc, flagInterruptMsgProc, interruptNet, InterruptSocks5(), mutexMsgProc, nMaxAddnode, nMaxFeeler, nMaxOutbound, semAddnode, and semOutbound.
Referenced by ~CConnman().
◆ IsBanned() [1/2]
bool CConnman::IsBanned | ( | CNetAddr | ip | ) |
Definition at line 577 of file net.cpp.
References cs_setBanned, GetTime(), LOCK, CSubNet::Match(), and CBanEntry::nBanUntil.
Referenced by AcceptConnection(), and OpenNetworkConnection().
◆ IsBanned() [2/2]
bool CConnman::IsBanned | ( | CSubNet | subnet | ) |
Definition at line 591 of file net.cpp.
References cs_setBanned, GetTime(), LOCK, and CBanEntry::nBanUntil.
◆ IsConnected()
◆ IsMasternodeOrDisconnectRequested()
bool CConnman::IsMasternodeOrDisconnectRequested | ( | const CService & | addr | ) |
Definition at line 3808 of file net.cpp.
References AllNodes, CNode::fDisconnect, CNode::fMasternode, and ForNode().
Referenced by CPrivateSendClientSession::JoinExistingQueue(), CPrivateSendClientSession::StartNewQueue(), and ThreadOpenMasternodeConnections().
◆ IsMasternodeQuorumNode()
bool CConnman::IsMasternodeQuorumNode | ( | const CNode * | pnode | ) |
Definition at line 3372 of file net.cpp.
References CNode::addr, cs_vPendingMasternodes, deterministicMNManager, CNode::fInbound, base_blob< BITS >::IsNull(), LOCK, masternodeQuorumNodes, and CNode::verifiedProRegTxHash.
Referenced by CMasternodeUtils::ProcessMasternodeConnections().
◆ IsWhitelistedRange()
|
private |
Definition at line 716 of file net.cpp.
References vWhitelistedRange.
Referenced by AcceptConnection().
◆ MarkAddressGood()
void CConnman::MarkAddressGood | ( | const CAddress & | addr | ) |
Definition at line 3267 of file net.cpp.
References addrman, and CAddrMan::Good().
Referenced by ProcessMessage().
◆ NodeFullyConnected()
|
staticprivate |
Definition at line 3728 of file net.cpp.
References CNode::fDisconnect, and CNode::fSuccessfullyConnected.
Referenced by CConnman::CFullyConnectedOnly::operator()().
◆ NotifyNumConnectionsChanged()
|
private |
Definition at line 1388 of file net.cpp.
References clientInterface, cs_vNodes, LOCK, masternodeSync, CClientUIInterface::NotifyNumConnectionsChanged, nPrevNodeCount, CMasternodeSync::Reset(), and vNodes.
Referenced by ThreadSocketHandler().
◆ OpenMasternodeConnection()
Definition at line 2697 of file net.cpp.
References OpenNetworkConnection().
Referenced by ThreadOpenMasternodeConnections().
◆ 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 | fConnectToMasternode = false , |
||
bool | fMasternodeProbe = false |
||
) |
Definition at line 2628 of file net.cpp.
References CChainParams::AllowMultiplePorts(), ConnectNode(), cs_vNodes, CNode::fFeeler, FindNode(), fLogIPs, CNode::fMasternode, CNode::fMasternodeProbe, fNetworkActive, CNode::fOneShot, CNode::GetId(), GetListenPort(), CService::GetPort(), CNode::grantOutbound, NetEventsInterface::InitializeNode(), interruptNet, IsBanned(), IsLocal(), LOCK, LogPrint, CNode::m_manual_connection, m_msgproc, mapSocketToNode, CSemaphoreGrant::MoveTo(), BCLog::NET_NETCONN, Params(), RegisterEvents(), CService::ToString(), CService::ToStringIPPort(), vNodes, and WakeSelect().
Referenced by OpenMasternodeConnection(), ProcessOneShot(), ThreadOpenAddedConnections(), and ThreadOpenConnections().
◆ OutboundTargetReached()
bool CConnman::OutboundTargetReached | ( | bool | historicalBlockServingLimit | ) |
check if the outbound target is reached
Definition at line 3587 of file net.cpp.
References cs_totalBytesSent, fDIP0001ActiveAtTip, GetMaxOutboundTimeLeftInCycle(), LOCK, and MaxBlockSize().
Referenced by ProcessGetBlockData(), and ProcessMessage().
◆ 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 3814 of file net.cpp.
References m_next_send_inv_to_incoming, and PoissonNextSend().
Referenced by PeerLogicValidation::SendMessages().
◆ ProcessOneShot()
|
private |
Definition at line 2169 of file net.cpp.
References cs_vOneShots, LOCK, OpenNetworkConnection(), and semOutbound.
Referenced by ThreadOpenConnections().
◆ PushMessage()
void CConnman::PushMessage | ( | CNode * | pnode, |
CSerializedNetMsg && | msg | ||
) |
Definition at line 3733 of file net.cpp.
References CNode::AddRef(), base_blob< BITS >::begin(), CMessageHeader::CHECKSUM_SIZE, cs_mapNodesWithDataToSend, CNode::cs_vSend, CNode::fPauseSend, CNode::GetId(), Hash(), CMessageHeader::HEADER_SIZE, INIT_PROTO_VERSION, LOCK, LogPrint, CNode::mapSendBytesPerMsgCmd, memcpy(), BCLog::NET, nSendBufferMaxSize, CNode::nSendMsgSize, CNode::nSendSize, Params(), RecordBytesSent(), SanitizeString(), SER_NETWORK, WakeSelect(), and wakeupSelectNeeded.
Referenced by PeerLogicValidation::ConsiderEviction(), PeerLogicValidation::NewPoWValidBlock(), ProcessGetBlockData(), ProcessGetData(), ProcessHeadersMessage(), CPrivateSendServer::ProcessMessage(), CPrivateSendClientSession::ProcessMessage(), CPrivateSendClientManager::ProcessMessage(), CGovernanceManager::ProcessMessage(), ProcessMessage(), PeerLogicValidation::ProcessMessages(), CPrivateSendClientSession::ProcessPendingDsaRequest(), CSporkManager::ProcessSpork(), CMasternodeSync::ProcessTick(), CMNAuth::PushMNAUTH(), CPrivateSendServer::PushStatus(), CPrivateSendQueue::Relay(), CGovernanceManager::RequestGovernanceObject(), SendBlockTransactions(), CMasternodeSync::SendGovernanceSyncRequest(), PeerLogicValidation::SendMessages(), SendRejectsAndCheckIfBanned(), CPrivateSendClientSession::SignFinalTransaction(), CGovernanceManager::SyncObjects(), and CGovernanceManager::SyncSingleObjVotes().
◆ RecordBytesRecv()
|
private |
Definition at line 3520 of file net.cpp.
References cs_totalBytesRecv, and LOCK.
Referenced by SocketRecvData().
◆ RecordBytesSent()
|
private |
Definition at line 3526 of file net.cpp.
References cs_totalBytesSent, GetTime(), and LOCK.
Referenced by PushMessage(), and SocketHandler().
◆ RegisterEvents()
|
private |
Definition at line 3870 of file net.cpp.
References CNode::cs_hSocket, INVALID_SOCKET, LOCK, LogPrint, BCLog::NET, NetworkErrorString(), SOCKETEVENTS_EPOLL, socketEventsMode, and WSAGetLastError.
Referenced by AcceptConnection(), and OpenNetworkConnection().
◆ RelayInv()
void CConnman::RelayInv | ( | CInv & | inv, |
const int | minProtoVersion = MIN_PEER_PROTO_VERSION , |
||
bool | fAllowMasternodeConnections = false |
||
) |
Definition at line 3482 of file net.cpp.
References cs_vNodes, LOCK, and vNodes.
Referenced by CPrivateSendServer::CommitFinalTransaction(), CGovernanceVote::Relay(), CSporkMessage::Relay(), and CGovernanceObject::Relay().
◆ RelayInvFiltered() [1/2]
void CConnman::RelayInvFiltered | ( | CInv & | inv, |
const CTransaction & | relatedTx, | ||
const int | minProtoVersion = MIN_PEER_PROTO_VERSION , |
||
bool | fAllowMasternodeConnections = false |
||
) |
◆ RelayInvFiltered() [2/2]
void CConnman::RelayInvFiltered | ( | CInv & | inv, |
const uint256 & | relatedTxHash, | ||
const int | minProtoVersion = MIN_PEER_PROTO_VERSION , |
||
bool | fAllowMasternodeConnections = false |
||
) |
◆ RelayTransaction()
void CConnman::RelayTransaction | ( | const CTransaction & | tx | ) |
Definition at line 3465 of file net.cpp.
References cs_vNodes, CPrivateSend::GetDSTX(), CTransaction::GetHash(), LOCK, MSG_DSTX, MSG_TX, and vNodes.
Referenced by CPrivateSendServer::ConsumeCollateral(), ProcessMessage(), CWalletTx::RelayWalletTransaction(), and while().
◆ ReleaseNodeVector()
void CConnman::ReleaseNodeVector | ( | const std::vector< CNode *> & | vecNodes | ) |
Definition at line 3850 of file net.cpp.
References CNode::Release().
Referenced by CMasternodeSync::ProcessTick(), CGovernanceManager::RequestOrphanObjects(), SocketHandler(), and ThreadMessageHandler().
◆ RemoveAddedNode()
bool CConnman::RemoveAddedNode | ( | const std::string & | node | ) |
Definition at line 3293 of file net.cpp.
References cs_vAddedNodes, and LOCK.
◆ RemoveMasternodeQuorumNodes()
void CConnman::RemoveMasternodeQuorumNodes | ( | Consensus::LLMQType | llmqType, |
const uint256 & | quorumHash | ||
) |
Definition at line 3366 of file net.cpp.
References cs_vPendingMasternodes, LOCK, and masternodeQuorumNodes.
◆ SetBanned()
void CConnman::SetBanned | ( | const banmap_t & | banmap | ) |
◆ SetBannedSetDirty()
|
private |
set the "dirty" flag for the banlist
Definition at line 709 of file net.cpp.
References cs_setBanned, and LOCK.
Referenced by DumpBanlist(), and Start().
◆ SetBestHeight()
void CConnman::SetBestHeight | ( | int | height | ) |
Definition at line 3633 of file net.cpp.
References nBestHeight.
Referenced by PeerLogicValidation::UpdatedBlockTip().
◆ SetMasternodeQuorumNodes()
void CConnman::SetMasternodeQuorumNodes | ( | Consensus::LLMQType | llmqType, |
const uint256 & | quorumHash, | ||
const std::set< uint256 > & | proTxHashes | ||
) |
Definition at line 3316 of file net.cpp.
References cs_vPendingMasternodes, LOCK, and masternodeQuorumNodes.
◆ SetMaxOutboundTarget()
void CConnman::SetMaxOutboundTarget | ( | uint64_t | limit | ) |
set the max outbound target in bytes
Definition at line 3543 of file net.cpp.
References cs_totalBytesSent, and LOCK.
◆ SetMaxOutboundTimeframe()
void CConnman::SetMaxOutboundTimeframe | ( | uint64_t | timeframe | ) |
set the timeframe for the max outbound target
Definition at line 3575 of file net.cpp.
References cs_totalBytesSent, GetTime(), and LOCK.
◆ SetNetworkActive()
void CConnman::SetNetworkActive | ( | bool | active | ) |
Definition at line 2886 of file net.cpp.
References fNetworkActive, LogPrint, masternodeSync, BCLog::NET, CClientUIInterface::NotifyNetworkActiveChanged, CMasternodeSync::Reset(), and uiInterface.
◆ SetServices()
void CConnman::SetServices | ( | const CService & | addr, |
ServiceFlags | nServices | ||
) |
Definition at line 3262 of file net.cpp.
References addrman, and CAddrMan::SetServices().
Referenced by ProcessMessage().
◆ SetTryNewOutboundPeer()
void CConnman::SetTryNewOutboundPeer | ( | bool | flag | ) |
Definition at line 2191 of file net.cpp.
References LogPrint, m_try_another_outbound_peer, and BCLog::NET.
Referenced by CConnman(), PeerLogicValidation::CheckForStaleTipAndEvictPeers(), and PeerLogicValidation::EvictExtraOutboundPeers().
◆ SocketEvents()
|
private |
Definition at line 1632 of file net.cpp.
References SOCKETEVENTS_EPOLL, SOCKETEVENTS_POLL, SOCKETEVENTS_SELECT, socketEventsMode, and SocketEventsSelect().
Referenced by SocketHandler().
◆ SocketEventsSelect()
|
private |
Definition at line 1557 of file net.cpp.
References GenerateSelectSet(), interruptNet, LogPrintf, NetworkErrorString(), SELECT_TIMEOUT_MILLISECONDS, CThreadInterrupt::sleep_for(), SOCKET_ERROR, wakeupSelectNeeded, and WSAGetLastError.
Referenced by SocketEvents().
◆ SocketHandler()
|
private |
Definition at line 1653 of file net.cpp.
References AcceptConnection(), cs_mapNodesWithDataToSend, cs_vNodes, interruptNet, INVALID_SOCKET, LOCK, LOCK2, LogPrint, mapSocketToNode, BCLog::NET, RecordBytesSent(), ReleaseNodeVector(), SocketEvents(), SocketRecvData(), SocketSendData(), vhListenSocket, and wakeupPipe.
Referenced by ThreadSocketHandler().
◆ SocketRecvData()
|
private |
Definition at line 1840 of file net.cpp.
References CNode::CloseSocketDisconnect(), CNode::cs_hSocket, cs_vNodes, CNode::cs_vProcessMsg, CNode::fDisconnect, CNode::fHasRecvData, CNode::fOtherSideDisconnected, CNode::fPauseRecv, CMessageHeader::HEADER_SIZE, INVALID_SOCKET, LOCK, LogPrint, LogPrintf, MSG_DONTWAIT, BCLog::NET, NetworkErrorString(), CNode::nProcessQueueSize, nReceiveFloodSize, CNode::ReceiveMsgBytes(), RecordBytesRecv(), CNode::vRecvMsg, WakeMessageHandler(), WSAEINPROGRESS, WSAEINTR, WSAEMSGSIZE, WSAEWOULDBLOCK, and WSAGetLastError.
Referenced by SocketHandler().
◆ SocketSendData()
|
private |
Definition at line 956 of file net.cpp.
References GetSystemTimeInSeconds(), INVALID_SOCKET, LOCK, LogPrintf, MSG_DONTWAIT, MSG_NOSIGNAL, NetworkErrorString(), WSAEINPROGRESS, WSAEINTR, WSAEMSGSIZE, WSAEWOULDBLOCK, and WSAGetLastError.
Referenced by SocketHandler().
◆ Start()
bool CConnman::Start | ( | CScheduler & | scheduler, |
const Options & | options | ||
) |
Definition at line 2957 of file net.cpp.
References _(), AddOneShot(), addrman, CAddrMan::Clear(), clientInterface, cs_totalBytesRecv, cs_totalBytesSent, DUMP_ADDRESSES_INTERVAL, DumpAddresses(), DumpBanlist(), DumpData(), fAddressesInitialized, flagInterruptMsgProc, fListen, fMsgProcWake, gArgs, ArgsManager::GetBoolArg(), GetTimeMillis(), Init(), InitBinds(), CClientUIInterface::InitMessage, interruptNet, InterruptSocks5(), LOCK, LogPrint, LogPrintf, m_msgproc, CConnman::Options::m_specified_outgoing, CConnman::Options::m_use_addrman_outgoing, CClientUIInterface::MSG_ERROR, mutexMsgProc, BCLog::NET, NetworkErrorString(), nMaxAddnode, nMaxConnections, nMaxFeeler, nMaxOutbound, CAddrDB::Read(), CBanDB::Read(), CThreadInterrupt::reset(), CScheduler::scheduleEvery(), scheduler, semAddnode, semOutbound, SetBanned(), SetBannedSetDirty(), CAddrMan::size(), SOCKETEVENTS_EPOLL, socketEventsMode, SweepBanned(), ThreadDNSAddressSeed(), threadDNSAddressSeed, ThreadMessageHandler(), threadMessageHandler, ThreadOpenAddedConnections(), threadOpenAddedConnections, ThreadOpenConnections(), threadOpenConnections, ThreadOpenMasternodeConnections(), threadOpenMasternodeConnections, CClientUIInterface::ThreadSafeMessageBox, ThreadSocketHandler(), threadSocketHandler, TraceThread(), uiInterface, CConnman::Options::vBinds, CConnman::Options::vSeedNodes, CConnman::Options::vWhiteBinds, wakeupPipe, and WSAGetLastError.
◆ Stop()
void CConnman::Stop | ( | ) |
Definition at line 3165 of file net.cpp.
References CloseSocket(), cs_mapNodesWithDataToSend, cs_vNodes, DeleteNode(), DumpData(), fAddressesInitialized, INVALID_SOCKET, LOCK, LogPrintf, mapSocketToNode, NetworkErrorString(), semAddnode, semOutbound, SOCKETEVENTS_EPOLL, socketEventsMode, threadDNSAddressSeed, threadMessageHandler, threadOpenAddedConnections, threadOpenConnections, threadOpenMasternodeConnections, threadSocketHandler, vhListenSocket, vNodes, vNodesDisconnected, wakeupPipe, and WSAGetLastError.
Referenced by ~CConnman().
◆ SweepBanned()
|
private |
clean unused entries (if bantime has expired)
Definition at line 675 of file net.cpp.
References CClientUIInterface::BannedListChanged, clientInterface, cs_setBanned, GetTime(), LOCK, LogPrint, CBanEntry::nBanUntil, BCLog::NET, and CSubNet::ToString().
Referenced by DumpBanlist(), GetBanned(), and Start().
◆ ThreadDNSAddressSeed()
|
private |
Definition at line 2076 of file net.cpp.
References CAddrMan::Add(), AddOneShot(), addrman, cs_vNodes, DEFAULT_FORCEDNSSEED, CChainParams::DNSSeeds(), gArgs, ArgsManager::GetBoolArg(), GetDesirableServiceFlags(), GetRand(), GetTime(), HaveNameProxy(), interruptNet, LOCK, LogPrintf, LookupHost(), NODE_NONE, CAddress::nTime, Params(), CNetAddr::SetInternal(), CAddrMan::size(), CThreadInterrupt::sleep_for(), strprintf, and vNodes.
Referenced by Start().
◆ ThreadMessageHandler()
|
private |
Definition at line 2701 of file net.cpp.
References condMsgProc, CopyNodeVector(), flagInterruptMsgProc, fMsgProcWake, GetTimeMillis(), LOCK, m_msgproc, mutexMsgProc, NetEventsInterface::ProcessMessages(), ReleaseNodeVector(), and NetEventsInterface::SendMessages().
Referenced by Start().
◆ ThreadOpenAddedConnections()
|
private |
Definition at line 2459 of file net.cpp.
References GetAddedNodeInfo(), interruptNet, NODE_NONE, OpenNetworkConnection(), semAddnode, CThreadInterrupt::sleep_for(), and CSemaphoreGrant::TryAcquire().
Referenced by Start().
◆ ThreadOpenConnections()
|
private |
Definition at line 2221 of file net.cpp.
References CAddrMan::Add(), addrman, CChainParams::AllowMultiplePorts(), convertSeed6(), cs_vNodes, deterministicMNManager, done, FEELER_INTERVAL, FEELER_SLEEP_WINDOW, fLogIPs, GetAdjustedTime(), CChainParams::GetDefaultPort(), CNetAddr::GetGroup(), GetListenPort(), CService::GetPort(), GetRandInt(), GetTime(), GetTimeMicros(), GetTryNewOutboundPeer(), HasAllDesirableServiceFlags(), interruptNet, IsLimited(), IsLocal(), CNetAddr::IsValid(), LOCK, LogPrint, LogPrintf, MayHaveUsefulAddressDB(), BCLog::NET, CAddrInfo::nLastTry, nMaxConnections, nMaxOutbound, NODE_NONE, CAddress::nServices, OpenNetworkConnection(), Params(), PoissonNextSend(), ProcessOneShot(), CAddrMan::Select(), semOutbound, CNetAddr::SetInternal(), CAddrMan::size(), CThreadInterrupt::sleep_for(), CService::ToString(), and vNodes.
Referenced by Start().
◆ ThreadOpenMasternodeConnections()
|
private |
Definition at line 2486 of file net.cpp.
References CNode::addr, AllNodes, cs_vNodes, cs_vPendingMasternodes, deterministicMNManager, CNode::fInbound, fNetworkActive, ForEachNode(), ForNode(), gArgs, GetAdjustedTime(), ArgsManager::GetArgs(), CMasternodeMetaMan::GetMetaInfo(), GetRandInt(), interruptNet, ArgsManager::IsArgSet(), CMasternodeSync::IsBlockchainSynced(), IsMasternodeOrDisconnectRequested(), base_blob< BITS >::IsNull(), LOCK2, LogPrint, masternodePendingProbes, masternodeQuorumNodes, masternodeSync, mmetaman, BCLog::NET_NETCONN, NODE_NETWORK, OpenMasternodeConnection(), Params(), CThreadInterrupt::sleep_for(), CNode::verifiedProRegTxHash, and vPendingMasternodes.
Referenced by Start().
◆ ThreadSocketHandler()
|
private |
Definition at line 1908 of file net.cpp.
References AllNodes, DisconnectNodes(), ForEachNode(), GetTimeMillis(), InactivityCheck(), interruptNet, NotifyNumConnectionsChanged(), and SocketHandler().
Referenced by Start().
◆ Unban() [1/2]
◆ Unban() [2/2]
bool CConnman::Unban | ( | const CSubNet & | ip | ) |
Definition at line 647 of file net.cpp.
References CClientUIInterface::BannedListChanged, clientInterface, cs_setBanned, DumpBanlist(), and LOCK.
◆ UnregisterEvents()
|
private |
Definition at line 3893 of file net.cpp.
References CNode::cs_hSocket, INVALID_SOCKET, LOCK, LogPrint, BCLog::NET, NetworkErrorString(), SOCKETEVENTS_EPOLL, socketEventsMode, and WSAGetLastError.
Referenced by CNode::CloseSocketDisconnect().
◆ WakeMessageHandler()
void CConnman::WakeMessageHandler | ( | ) |
Definition at line 1928 of file net.cpp.
References condMsgProc, fMsgProcWake, and mutexMsgProc.
Referenced by SocketRecvData(), and PeerLogicValidation::UpdatedBlockTip().
◆ WakeSelect()
void CConnman::WakeSelect | ( | ) |
Definition at line 1937 of file net.cpp.
References LogPrint, BCLog::NET, wakeupPipe, and wakeupSelectNeeded.
Referenced by AcceptConnection(), OpenNetworkConnection(), and PushMessage().
Friends And Related Function Documentation
◆ CConnmanTest
◆ CNode
|
friend |
Definition at line 138 of file net.h.
Referenced by AcceptConnection(), and ConnectNode().
Member Data Documentation
◆ addrman
|
private |
Definition at line 566 of file net.h.
Referenced by AddNewAddresses(), ConnectNode(), DeleteNode(), DumpAddresses(), GetAddressCount(), GetAddresses(), MarkAddressGood(), SetServices(), Start(), ThreadDNSAddressSeed(), and ThreadOpenConnections().
◆ AllNodes
|
static |
Definition at line 225 of file net.h.
Referenced by CopyNodeVector(), CActiveMasternodeManager::GetLocalAddress(), IsMasternodeOrDisconnectRequested(), masternode_connect(), CMasternodeUtils::ProcessMasternodeConnections(), CMasternodeSync::SwitchToNextAsset(), ThreadOpenMasternodeConnections(), and ThreadSocketHandler().
◆ clientInterface
|
private |
Definition at line 592 of file net.h.
Referenced by Ban(), Bind(), ClearBanned(), Init(), NotifyNumConnectionsChanged(), Start(), SweepBanned(), and Unban().
◆ condMsgProc
|
private |
Definition at line 601 of file net.h.
Referenced by Interrupt(), ThreadMessageHandler(), and WakeMessageHandler().
◆ cs_mapNodesWithDataToSend
|
mutableprivate |
Definition at line 623 of file net.h.
Referenced by CNode::CloseSocketDisconnect(), PushMessage(), SocketHandler(), and Stop().
◆ cs_setBanned
|
private |
Definition at line 563 of file net.h.
Referenced by Ban(), BannedSetIsDirty(), ClearBanned(), GetBanned(), IsBanned(), SetBanned(), SetBannedSetDirty(), SweepBanned(), and Unban().
◆ cs_totalBytesRecv
|
private |
Definition at line 542 of file net.h.
Referenced by GetTotalBytesRecv(), RecordBytesRecv(), and Start().
◆ cs_totalBytesSent
|
private |
Definition at line 543 of file net.h.
Referenced by GetMaxOutboundTarget(), GetMaxOutboundTimeframe(), GetMaxOutboundTimeLeftInCycle(), GetOutboundTargetBytesLeft(), GetTotalBytesSent(), Init(), OutboundTargetReached(), RecordBytesSent(), SetMaxOutboundTarget(), SetMaxOutboundTimeframe(), and Start().
◆ cs_vAddedNodes
|
private |
Definition at line 570 of file net.h.
Referenced by AddNode(), GetAddedNodeInfo(), Init(), and RemoveAddedNode().
◆ cs_vNodes
|
mutableprivate |
Definition at line 578 of file net.h.
Referenced by AcceptConnection(), AttemptToEvictConnection(), Ban(), CheckIncomingNonce(), CNode::CloseSocketDisconnect(), ConnectNode(), CopyNodeVector(), DisconnectNode(), DisconnectNodes(), FindNode(), ForEachNode(), ForEachNodeContinueIf(), ForEachNodeThen(), ForNode(), GenerateSelectSet(), GetAddedNodeInfo(), GetExtraOutboundCount(), GetMasternodeQuorumNodes(), GetNodeCount(), GetNodeStats(), NotifyNumConnectionsChanged(), OpenNetworkConnection(), RelayInv(), RelayInvFiltered(), RelayTransaction(), SocketHandler(), SocketRecvData(), Stop(), ThreadDNSAddressSeed(), ThreadOpenConnections(), and ThreadOpenMasternodeConnections().
◆ cs_vOneShots
|
private |
Definition at line 568 of file net.h.
Referenced by AddOneShot(), and ProcessOneShot().
◆ cs_vPendingMasternodes
|
mutableprivate |
Definition at line 574 of file net.h.
Referenced by AddPendingMasternode(), AddPendingProbeConnections(), GetMasternodeQuorumNodes(), GetMasternodeQuorums(), HasMasternodeQuorumNodes(), IsMasternodeQuorumNode(), RemoveMasternodeQuorumNodes(), SetMasternodeQuorumNodes(), and ThreadOpenMasternodeConnections().
◆ fAddressesInitialized
|
private |
Definition at line 565 of file net.h.
Referenced by CConnman(), Start(), and Stop().
◆ flagInterruptMsgProc
|
private |
Definition at line 603 of file net.h.
Referenced by CConnman(), Interrupt(), Start(), and ThreadMessageHandler().
◆ fMsgProcWake
|
private |
flag for waking the message processor.
Definition at line 599 of file net.h.
Referenced by Start(), ThreadMessageHandler(), and WakeMessageHandler().
◆ fNetworkActive
|
private |
Definition at line 561 of file net.h.
Referenced by AcceptConnection(), CConnman(), DisconnectNodes(), GetNetworkActive(), OpenNetworkConnection(), SetNetworkActive(), and ThreadOpenMasternodeConnections().
◆ FullyConnectedOnly
|
static |
Definition at line 219 of file net.h.
Referenced by ForEachNode(), ForEachNodeContinueIf(), ForEachNodeThen(), ForNode(), CMasternodeSync::ProcessTick(), CGovernanceManager::RequestOrphanObjects(), and llmq::CSigSharesManager::SendMessages().
◆ interruptNet
|
private |
Definition at line 605 of file net.h.
Referenced by Interrupt(), OpenNetworkConnection(), SocketEventsSelect(), SocketHandler(), Start(), ThreadDNSAddressSeed(), ThreadOpenAddedConnections(), ThreadOpenConnections(), ThreadOpenMasternodeConnections(), and ThreadSocketHandler().
◆ m_msgproc
|
private |
Definition at line 593 of file net.h.
Referenced by AcceptConnection(), DeleteNode(), Init(), OpenNetworkConnection(), Start(), and ThreadMessageHandler().
◆ m_next_send_inv_to_incoming
|
private |
Definition at line 637 of file net.h.
Referenced by PoissonNextSendInbound().
◆ m_try_another_outbound_peer
|
private |
flag for deciding to connect to an extra outbound peer, in excess of nMaxOutbound This takes the place of a feeler connection
Definition at line 635 of file net.h.
Referenced by GetTryNewOutboundPeer(), and SetTryNewOutboundPeer().
◆ mapSocketToNode
Definition at line 577 of file net.h.
Referenced by AcceptConnection(), CNode::CloseSocketDisconnect(), OpenNetworkConnection(), SocketHandler(), and Stop().
◆ masternodePendingProbes
|
private |
Definition at line 573 of file net.h.
Referenced by AddPendingProbeConnections(), and ThreadOpenMasternodeConnections().
◆ masternodeQuorumNodes
|
private |
Definition at line 572 of file net.h.
Referenced by GetMasternodeQuorumNodes(), GetMasternodeQuorums(), HasMasternodeQuorumNodes(), IsMasternodeQuorumNode(), RemoveMasternodeQuorumNodes(), SetMasternodeQuorumNodes(), and ThreadOpenMasternodeConnections().
◆ mutexMsgProc
|
private |
Definition at line 602 of file net.h.
Referenced by Interrupt(), Start(), ThreadMessageHandler(), and WakeMessageHandler().
◆ nBestHeight
|
private |
Definition at line 591 of file net.h.
Referenced by GetBestHeight(), Init(), and SetBestHeight().
◆ nLastNodeId
|
private |
Definition at line 579 of file net.h.
Referenced by CConnman(), and GetNewNodeId().
◆ nLocalServices
|
private |
Services this instance offers.
Definition at line 583 of file net.h.
Referenced by AcceptConnection(), ConnectNode(), GetLocalServices(), and Init().
◆ nMaxAddnode
|
private |
Definition at line 589 of file net.h.
Referenced by Init(), Interrupt(), and Start().
◆ nMaxConnections
|
private |
Definition at line 587 of file net.h.
Referenced by AcceptConnection(), Init(), Start(), and ThreadOpenConnections().
◆ nMaxFeeler
|
private |
Definition at line 590 of file net.h.
Referenced by AcceptConnection(), Init(), Interrupt(), and Start().
◆ nMaxOutbound
|
private |
Definition at line 588 of file net.h.
Referenced by AcceptConnection(), GetExtraOutboundCount(), GetMaxOutboundNodeCount(), Init(), Interrupt(), Start(), and ThreadOpenConnections().
◆ nPrevNodeCount
|
private |
Definition at line 580 of file net.h.
Referenced by CConnman(), and NotifyNumConnectionsChanged().
◆ nReceiveFloodSize
|
private |
Definition at line 558 of file net.h.
Referenced by CConnman(), GetReceiveFloodSize(), Init(), and SocketRecvData().
◆ nSeed0
|
private |
SipHasher seeds for deterministic randomness.
Definition at line 596 of file net.h.
Referenced by GetDeterministicRandomizer().
◆ nSeed1
|
private |
Definition at line 596 of file net.h.
Referenced by GetDeterministicRandomizer().
◆ nSendBufferMaxSize
|
private |
Definition at line 557 of file net.h.
Referenced by CConnman(), Init(), and PushMessage().
◆ semAddnode
|
private |
Definition at line 586 of file net.h.
Referenced by Interrupt(), Start(), Stop(), and ThreadOpenAddedConnections().
◆ semOutbound
|
private |
Definition at line 585 of file net.h.
Referenced by Interrupt(), ProcessOneShot(), Start(), Stop(), and ThreadOpenConnections().
◆ socketEventsMode
|
private |
Definition at line 613 of file net.h.
Referenced by BindListenPort(), GetSocketEventsMode(), Init(), RegisterEvents(), SocketEvents(), Start(), Stop(), and UnregisterEvents().
◆ threadDNSAddressSeed
|
private |
◆ threadMessageHandler
|
private |
◆ threadOpenAddedConnections
|
private |
◆ threadOpenConnections
|
private |
◆ threadOpenMasternodeConnections
|
private |
◆ threadSocketHandler
|
private |
◆ vhListenSocket
|
private |
Definition at line 560 of file net.h.
Referenced by BindListenPort(), GenerateSelectSet(), SocketHandler(), and Stop().
◆ vNodes
|
private |
Definition at line 575 of file net.h.
Referenced by AcceptConnection(), AttemptToEvictConnection(), Ban(), CheckIncomingNonce(), CopyNodeVector(), DisconnectNode(), DisconnectNodes(), FindNode(), ForEachNode(), ForEachNodeContinueIf(), ForEachNodeThen(), ForNode(), GenerateSelectSet(), GetAddedNodeInfo(), GetExtraOutboundCount(), GetMasternodeQuorumNodes(), GetNodeCount(), GetNodeStats(), NotifyNumConnectionsChanged(), OpenNetworkConnection(), RelayInv(), RelayInvFiltered(), RelayTransaction(), Stop(), ThreadDNSAddressSeed(), and ThreadOpenConnections().
◆ vNodesDisconnected
|
private |
Definition at line 576 of file net.h.
Referenced by DisconnectNodes(), and Stop().
◆ vPendingMasternodes
|
private |
Definition at line 571 of file net.h.
Referenced by AddPendingMasternode(), and ThreadOpenMasternodeConnections().
◆ vWhitelistedRange
|
private |
Definition at line 555 of file net.h.
Referenced by Init(), and IsWhitelistedRange().
◆ wakeupPipe
|
private |
a pipe which is added to select() calls to wakeup before the timeout
Definition at line 609 of file net.h.
Referenced by GenerateSelectSet(), SocketHandler(), Start(), Stop(), and WakeSelect().
◆ wakeupSelectNeeded
|
private |
Definition at line 611 of file net.h.
Referenced by PushMessage(), SocketEventsSelect(), and WakeSelect().
The documentation for this class was generated from the following files: