Dash Core  0.12.2.1
P2P Digital Currency
CNode Class Reference

#include <net.h>

Public Member Functions

 CNode (NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, const std::string &addrNameIn="", bool fInboundIn=false, bool fNetworkNodeIn=false)
 
 ~CNode ()
 
NodeId GetId () const
 
uint64_t GetLocalNonce () const
 
int GetMyStartingHeight () const
 
int GetRefCount ()
 
bool ReceiveMsgBytes (const char *pch, unsigned int nBytes, bool &complete)
 
void SetRecvVersion (int nVersionIn)
 
int GetRecvVersion ()
 
void SetSendVersion (int nVersionIn)
 
int GetSendVersion () const
 
CNodeAddRef ()
 
void Release ()
 
void AddAddressKnown (const CAddress &addr)
 
void PushAddress (const CAddress &addr)
 
void AddInventoryKnown (const CInv &inv)
 
void PushInventory (const CInv &inv)
 
void PushBlockHash (const uint256 &hash)
 
void PushBlockHashFromINV (const uint256 &hash)
 
void AskFor (const CInv &inv)
 
void CloseSocketDisconnect ()
 
void copyStats (CNodeStats &stats)
 
ServiceFlags GetLocalServices () const
 

Static Public Member Functions

static std::vector< unsigned char > CalculateKeyedNetGroup (CAddress &address)
 

Public Attributes

ServiceFlags nServices
 
ServiceFlags nServicesExpected
 
SOCKET hSocket
 
size_t nSendSize
 
size_t nSendOffset
 
uint64_t nSendBytes
 
std::deque< CSerializeDatavSendMsg
 
CCriticalSection cs_vSend
 
CCriticalSection cs_vProcessMsg
 
std::list< CNetMessagevProcessMsg
 
size_t nProcessQueueSize
 
std::deque< CInvvRecvGetData
 
uint64_t nRecvBytes
 
std::atomic< int > nRecvVersion
 
int64_t nLastSend
 
int64_t nLastRecv
 
int64_t nTimeConnected
 
int64_t nTimeOffset
 
int64_t nLastWarningTime
 
CAddress addr
 
std::string addrName
 
CService addrLocal
 
int nNumWarningsSkipped
 
std::atomic< int > nVersion
 
std::string strSubVer
 
std::string cleanSubVer
 
bool fWhitelisted
 
bool fFeeler
 
bool fOneShot
 
bool fClient
 
bool fInbound
 
bool fNetworkNode
 
std::atomic_bool fSuccessfullyConnected
 
bool fDisconnect
 
bool fRelayTxes
 
bool fMasternode
 
CSemaphoreGrant grantOutbound
 
CSemaphoreGrant grantMasternodeOutbound
 
CCriticalSection cs_filter
 
CBloomFilterpfilter
 
int nRefCount
 
NodeId id
 
std::atomic_bool fPauseRecv
 
std::atomic_bool fPauseSend
 
uint256 hashContinue
 
int nStartingHeight
 
std::vector< CAddressvAddrToSend
 
CRollingBloomFilter addrKnown
 
bool fGetAddr
 
std::set< uint256setKnown
 
int64_t nNextAddrSend
 
int64_t nNextLocalAddrSend
 
CRollingBloomFilter filterInventoryKnown
 
std::vector< CInvvInventoryToSend
 
CCriticalSection cs_inventory
 
std::set< uint256setAskFor
 
std::multimap< int64_t, CInvmapAskFor
 
int64_t nNextInvSend
 
std::vector< uint256vBlockHashesToAnnounce
 
std::vector< uint256vBlockHashesFromINV
 
std::atomic< int64_t > nLastBlockTime
 
std::atomic< int64_t > nLastTXTime
 
uint64_t nPingNonceSent
 
int64_t nPingUsecStart
 
int64_t nPingUsecTime
 
int64_t nMinPingUsecTime
 
bool fPingQueued
 
std::vector< unsigned char > vchKeyedNetGroup
 

Protected Attributes

mapMsgCmdSize mapSendBytesPerMsgCmd
 
mapMsgCmdSize mapRecvBytesPerMsgCmd
 

Private Member Functions

 CNode (const CNode &)
 
void operator= (const CNode &)
 

Private Attributes

CCriticalSection cs_nRefCount
 
uint64_t nLocalHostNonce
 
ServiceFlags nLocalServices
 
int nMyStartingHeight
 
int nSendVersion
 
std::list< CNetMessagevRecvMsg
 

Static Private Attributes

static std::vector< unsigned char > vchSecretKey
 

Friends

class CConnman
 

Detailed Description

Information about a peer

Definition at line 661 of file net.h.

Constructor & Destructor Documentation

◆ CNode() [1/2]

CNode::CNode ( NodeId  id,
ServiceFlags  nLocalServicesIn,
int  nMyStartingHeightIn,
SOCKET  hSocketIn,
const CAddress addrIn,
const std::string &  addrNameIn = "",
bool  fInboundIn = false,
bool  fNetworkNodeIn = false 
)

Definition at line 2665 of file net.cpp.

◆ ~CNode()

CNode::~CNode ( )

Definition at line 2737 of file net.cpp.

◆ CNode() [2/2]

CNode::CNode ( const CNode )
private

Member Function Documentation

◆ AddAddressKnown()

void CNode::AddAddressKnown ( const CAddress addr)
inline

Definition at line 838 of file net.h.

Referenced by ProcessMessage().

◆ AddInventoryKnown()

void CNode::AddInventoryKnown ( const CInv inv)
inline

Definition at line 858 of file net.h.

Referenced by ProcessMessage().

◆ AddRef()

CNode* CNode::AddRef ( )
inline

Definition at line 822 of file net.h.

Referenced by CNode(), CConnman::ConnectNode(), and CConnman::CopyNodeVector().

◆ AskFor()

void CNode::AskFor ( const CInv inv)

Definition at line 2745 of file net.cpp.

Referenced by CGovernanceManager::ProcessMessage(), and ProcessMessage().

◆ CalculateKeyedNetGroup()

std::vector< unsigned char > CNode::CalculateKeyedNetGroup ( CAddress address)
static

Definition at line 2796 of file net.cpp.

Referenced by CNode().

◆ CloseSocketDisconnect()

void CNode::CloseSocketDisconnect ( )

Definition at line 462 of file net.cpp.

Referenced by CConnman::SetNetworkActive(), and CConnman::ThreadSocketHandler().

◆ copyStats()

void CNode::copyStats ( CNodeStats stats)

Definition at line 635 of file net.cpp.

Referenced by CConnman::GetNodeStats().

◆ GetId()

◆ GetLocalNonce()

uint64_t CNode::GetLocalNonce ( ) const
inline

Definition at line 794 of file net.h.

Referenced by CConnman::CheckIncomingNonce().

◆ GetLocalServices()

ServiceFlags CNode::GetLocalServices ( ) const
inline

Definition at line 897 of file net.h.

Referenced by AdvertiseLocal(), and ProcessMessage().

◆ GetMyStartingHeight()

int CNode::GetMyStartingHeight ( ) const
inline

Definition at line 798 of file net.h.

◆ GetRecvVersion()

int CNode::GetRecvVersion ( )
inline

Definition at line 815 of file net.h.

Referenced by ProcessMessages().

◆ GetRefCount()

int CNode::GetRefCount ( )
inline

Definition at line 802 of file net.h.

Referenced by CConnman::ThreadSocketHandler().

◆ GetSendVersion()

int CNode::GetSendVersion ( ) const

Definition at line 742 of file net.cpp.

Referenced by CConnman::BeginMessage().

◆ operator=()

void CNode::operator= ( const CNode )
private

◆ PushAddress()

void CNode::PushAddress ( const CAddress addr)
inline

Definition at line 843 of file net.h.

Referenced by AdvertiseLocal(), and ProcessMessage().

◆ PushBlockHash()

void CNode::PushBlockHash ( const uint256 hash)
inline

Definition at line 879 of file net.h.

◆ PushBlockHashFromINV()

void CNode::PushBlockHashFromINV ( const uint256 hash)
inline

Definition at line 885 of file net.h.

Referenced by ProcessMessage().

◆ PushInventory()

◆ ReceiveMsgBytes()

bool CNode::ReceiveMsgBytes ( const char *  pch,
unsigned int  nBytes,
bool &  complete 
)

Definition at line 677 of file net.cpp.

Referenced by CConnman::ThreadSocketHandler().

◆ Release()

void CNode::Release ( )
inline

Definition at line 829 of file net.h.

Referenced by CConnman::ReleaseNodeVector(), and CConnman::ThreadSocketHandler().

◆ SetRecvVersion()

void CNode::SetRecvVersion ( int  nVersionIn)
inline

Definition at line 811 of file net.h.

Referenced by ProcessMessage().

◆ SetSendVersion()

void CNode::SetSendVersion ( int  nVersionIn)

Definition at line 728 of file net.cpp.

Referenced by ProcessMessage().

Friends And Related Function Documentation

◆ CConnman

friend class CConnman
friend

Definition at line 663 of file net.h.

Member Data Documentation

◆ addr

◆ addrKnown

CRollingBloomFilter CNode::addrKnown

Definition at line 733 of file net.h.

Referenced by AddAddressKnown(), PushAddress(), and SendMessages().

◆ addrLocal

CService CNode::addrLocal

Definition at line 690 of file net.h.

Referenced by AdvertiseLocal(), copyStats(), IsPeerAddrLocalGood(), and ProcessMessage().

◆ addrName

std::string CNode::addrName

◆ cleanSubVer

std::string CNode::cleanSubVer

Definition at line 697 of file net.h.

Referenced by copyStats(), and ProcessMessage().

◆ cs_filter

CCriticalSection CNode::cs_filter

Definition at line 715 of file net.h.

Referenced by ProcessGetData(), ProcessMessage(), and CConnman::RelayTransaction().

◆ cs_inventory

◆ cs_nRefCount

CCriticalSection CNode::cs_nRefCount
private

Definition at line 778 of file net.h.

Referenced by AddRef(), GetRefCount(), and Release().

◆ cs_vProcessMsg

CCriticalSection CNode::cs_vProcessMsg

Definition at line 675 of file net.h.

Referenced by ProcessMessages(), and CConnman::ThreadSocketHandler().

◆ cs_vSend

◆ fClient

bool CNode::fClient

Definition at line 701 of file net.h.

Referenced by CNode(), ProcessMessage(), and SendMessages().

◆ fDisconnect

◆ fFeeler

bool CNode::fFeeler

Definition at line 699 of file net.h.

Referenced by CNode(), CConnman::OpenNetworkConnection(), and ProcessMessage().

◆ fGetAddr

bool CNode::fGetAddr

Definition at line 734 of file net.h.

Referenced by CNode(), and ProcessMessage().

◆ filterInventoryKnown

CRollingBloomFilter CNode::filterInventoryKnown

Definition at line 740 of file net.h.

Referenced by AddInventoryKnown(), CNode(), PushInventory(), and SendMessages().

◆ fInbound

◆ fMasternode

◆ fNetworkNode

bool CNode::fNetworkNode

Definition at line 703 of file net.h.

Referenced by CNode(), ProcessMessage(), and CConnman::ThreadSocketHandler().

◆ fOneShot

bool CNode::fOneShot

Definition at line 700 of file net.h.

Referenced by CNode(), CConnman::OpenNetworkConnection(), ProcessMessage(), and SendMessages().

◆ fPauseRecv

std::atomic_bool CNode::fPauseRecv

Definition at line 720 of file net.h.

Referenced by CNode(), ProcessMessages(), and CConnman::ThreadSocketHandler().

◆ fPauseSend

std::atomic_bool CNode::fPauseSend

◆ fPingQueued

bool CNode::fPingQueued

Definition at line 767 of file net.h.

Referenced by CNode(), ping(), and SendMessages().

◆ fRelayTxes

bool CNode::fRelayTxes

Definition at line 710 of file net.h.

Referenced by CNode(), copyStats(), ProcessMessage(), and CConnman::RelayTransaction().

◆ fSuccessfullyConnected

std::atomic_bool CNode::fSuccessfullyConnected

◆ fWhitelisted

◆ grantMasternodeOutbound

CSemaphoreGrant CNode::grantMasternodeOutbound

Definition at line 714 of file net.h.

Referenced by CConnman::ThreadMnbRequestConnections(), and CConnman::ThreadSocketHandler().

◆ grantOutbound

CSemaphoreGrant CNode::grantOutbound

Definition at line 713 of file net.h.

Referenced by CConnman::OpenNetworkConnection(), and CConnman::ThreadSocketHandler().

◆ hashContinue

uint256 CNode::hashContinue

Definition at line 728 of file net.h.

Referenced by CNode(), ProcessGetData(), and ProcessMessage().

◆ hSocket

◆ id

◆ mapAskFor

std::multimap<int64_t, CInv> CNode::mapAskFor

Definition at line 744 of file net.h.

Referenced by AskFor(), and SendMessages().

◆ mapRecvBytesPerMsgCmd

mapMsgCmdSize CNode::mapRecvBytesPerMsgCmd
protected

Definition at line 725 of file net.h.

Referenced by CNode(), copyStats(), and ReceiveMsgBytes().

◆ mapSendBytesPerMsgCmd

mapMsgCmdSize CNode::mapSendBytesPerMsgCmd
protected

Definition at line 724 of file net.h.

Referenced by copyStats(), and CConnman::PushMessage().

◆ nLastBlockTime

std::atomic<int64_t> CNode::nLastBlockTime

Definition at line 754 of file net.h.

Referenced by CNode(), and ProcessMessage().

◆ nLastRecv

int64_t CNode::nLastRecv

Definition at line 684 of file net.h.

Referenced by CNode(), copyStats(), ReceiveMsgBytes(), and CConnman::ThreadSocketHandler().

◆ nLastSend

int64_t CNode::nLastSend

Definition at line 683 of file net.h.

Referenced by CNode(), copyStats(), CConnman::SocketSendData(), and CConnman::ThreadSocketHandler().

◆ nLastTXTime

std::atomic<int64_t> CNode::nLastTXTime

Definition at line 755 of file net.h.

Referenced by CNode(), and ProcessMessage().

◆ nLastWarningTime

int64_t CNode::nLastWarningTime

Definition at line 687 of file net.h.

Referenced by AskFor(), and CNode().

◆ nLocalHostNonce

uint64_t CNode::nLocalHostNonce
private

Definition at line 783 of file net.h.

Referenced by CNode(), and GetLocalNonce().

◆ nLocalServices

ServiceFlags CNode::nLocalServices
private

Definition at line 784 of file net.h.

Referenced by CNode(), and GetLocalServices().

◆ nMinPingUsecTime

int64_t CNode::nMinPingUsecTime

Definition at line 765 of file net.h.

Referenced by CNode(), copyStats(), and ProcessMessage().

◆ nMyStartingHeight

int CNode::nMyStartingHeight
private

Definition at line 785 of file net.h.

Referenced by CNode(), and GetMyStartingHeight().

◆ nNextAddrSend

int64_t CNode::nNextAddrSend

Definition at line 736 of file net.h.

Referenced by CNode(), and SendMessages().

◆ nNextInvSend

int64_t CNode::nNextInvSend

Definition at line 745 of file net.h.

Referenced by CNode(), and SendMessages().

◆ nNextLocalAddrSend

int64_t CNode::nNextLocalAddrSend

Definition at line 737 of file net.h.

Referenced by CNode(), and SendMessages().

◆ nNumWarningsSkipped

int CNode::nNumWarningsSkipped

Definition at line 691 of file net.h.

Referenced by AskFor(), and CNode().

◆ nPingNonceSent

uint64_t CNode::nPingNonceSent

Definition at line 759 of file net.h.

Referenced by CNode(), copyStats(), ProcessMessage(), SendMessages(), and CConnman::ThreadSocketHandler().

◆ nPingUsecStart

int64_t CNode::nPingUsecStart

Definition at line 761 of file net.h.

Referenced by CNode(), copyStats(), ProcessMessage(), SendMessages(), and CConnman::ThreadSocketHandler().

◆ nPingUsecTime

int64_t CNode::nPingUsecTime

Definition at line 763 of file net.h.

Referenced by CNode(), copyStats(), and ProcessMessage().

◆ nProcessQueueSize

size_t CNode::nProcessQueueSize

Definition at line 677 of file net.h.

Referenced by CNode(), ProcessMessages(), and CConnman::ThreadSocketHandler().

◆ nRecvBytes

uint64_t CNode::nRecvBytes

Definition at line 680 of file net.h.

Referenced by CNode(), copyStats(), and ReceiveMsgBytes().

◆ nRecvVersion

std::atomic<int> CNode::nRecvVersion

Definition at line 681 of file net.h.

Referenced by CNode(), GetRecvVersion(), and SetRecvVersion().

◆ nRefCount

int CNode::nRefCount

Definition at line 717 of file net.h.

Referenced by AddRef(), CNode(), GetRefCount(), and Release().

◆ nSendBytes

uint64_t CNode::nSendBytes

Definition at line 671 of file net.h.

Referenced by CNode(), copyStats(), and CConnman::SocketSendData().

◆ nSendOffset

size_t CNode::nSendOffset

Definition at line 670 of file net.h.

Referenced by CNode(), and CConnman::SocketSendData().

◆ nSendSize

size_t CNode::nSendSize

Definition at line 669 of file net.h.

Referenced by CNode(), CConnman::PushMessage(), and CConnman::SocketSendData().

◆ nSendVersion

int CNode::nSendVersion
private

Definition at line 786 of file net.h.

Referenced by GetSendVersion(), and SetSendVersion().

◆ nServices

ServiceFlags CNode::nServices

Definition at line 666 of file net.h.

Referenced by CNode(), copyStats(), and ProcessMessage().

◆ nServicesExpected

ServiceFlags CNode::nServicesExpected

Definition at line 667 of file net.h.

Referenced by CNode(), CConnman::ConnectNode(), and ProcessMessage().

◆ nStartingHeight

int CNode::nStartingHeight

◆ nTimeConnected

int64_t CNode::nTimeConnected

Definition at line 685 of file net.h.

Referenced by CNode(), CConnman::ConnectNode(), copyStats(), and CConnman::ThreadSocketHandler().

◆ nTimeOffset

int64_t CNode::nTimeOffset

Definition at line 686 of file net.h.

Referenced by CNode(), copyStats(), and ProcessMessage().

◆ nVersion

◆ pfilter

CBloomFilter* CNode::pfilter

Definition at line 716 of file net.h.

Referenced by CNode(), ProcessGetData(), ProcessMessage(), CConnman::RelayTransaction(), and ~CNode().

◆ setAskFor

◆ setKnown

std::set<uint256> CNode::setKnown

Definition at line 735 of file net.h.

Referenced by ProcessMessage(), and CAlert::RelayTo().

◆ strSubVer

std::string CNode::strSubVer

Definition at line 697 of file net.h.

Referenced by CNode(), ProcessMessage(), and CAlert::RelayTo().

◆ vAddrToSend

std::vector<CAddress> CNode::vAddrToSend

Definition at line 732 of file net.h.

Referenced by ProcessMessage(), PushAddress(), and SendMessages().

◆ vBlockHashesFromINV

std::vector<uint256> CNode::vBlockHashesFromINV

Definition at line 751 of file net.h.

Referenced by PushBlockHashFromINV(), and SendMessages().

◆ vBlockHashesToAnnounce

std::vector<uint256> CNode::vBlockHashesToAnnounce

Definition at line 748 of file net.h.

Referenced by PushBlockHash(), and SendMessages().

◆ vchKeyedNetGroup

std::vector<unsigned char> CNode::vchKeyedNetGroup

Definition at line 769 of file net.h.

Referenced by CNode().

◆ vchSecretKey

std::vector< unsigned char > CNode::vchSecretKey
staticprivate

Definition at line 776 of file net.h.

Referenced by CalculateKeyedNetGroup().

◆ vInventoryToSend

std::vector<CInv> CNode::vInventoryToSend

Definition at line 741 of file net.h.

Referenced by PushInventory(), and SendMessages().

◆ vProcessMsg

std::list<CNetMessage> CNode::vProcessMsg

Definition at line 676 of file net.h.

Referenced by ProcessMessages(), and CConnman::ThreadSocketHandler().

◆ vRecvGetData

std::deque<CInv> CNode::vRecvGetData

Definition at line 679 of file net.h.

Referenced by ProcessGetData(), ProcessMessage(), and ProcessMessages().

◆ vRecvMsg

std::list<CNetMessage> CNode::vRecvMsg
private

Definition at line 787 of file net.h.

Referenced by ReceiveMsgBytes(), and CConnman::ThreadSocketHandler().

◆ vSendMsg

std::deque<CSerializeData> CNode::vSendMsg

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