Bitcoin Core  0.18.99
P2P Digital Currency
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
CNode Class Reference

Information about a peer. More...

#include <net.h>

Collaboration diagram for CNode:
[legend]

Public Member Functions

SOCKET hSocket GUARDED_BY (cs_hSocket)
 
uint64_t nSendBytes GUARDED_BY (cs_vSend)
 
std::deque< std::vector< unsigned char > > vSendMsg GUARDED_BY (cs_vSend)
 
std::list< CNetMessage > vProcessMsg GUARDED_BY (cs_vProcessMsg)
 
uint64_t nRecvBytes GUARDED_BY (cs_vRecv)
 
std::string strSubVer GUARDED_BY (cs_SubVer)
 
std::string strSubVer cleanSubVer GUARDED_BY (cs_SubVer)
 
bool fRelayTxes GUARDED_BY (cs_filter)
 
std::unique_ptr< CBloomFilter > pfilter PT_GUARDED_BY (cs_filter)
 
int64_t nNextAddrSend GUARDED_BY (cs_sendProcessing)
 
int64_t nNextLocalAddrSend GUARDED_BY (cs_sendProcessing)
 
CRollingBloomFilter filterInventoryKnown GUARDED_BY (cs_inventory)
 
std::vector< uint256 > vInventoryBlockToSend GUARDED_BY (cs_inventory)
 
std::vector< uint256 > vBlockHashesToAnnounce GUARDED_BY (cs_inventory)
 
bool fSendMempool GUARDED_BY (cs_inventory)
 
CAmount minFeeFilter GUARDED_BY (cs_feeFilter)
 
 CNode (NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const CAddress &addrBindIn, const std::string &addrNameIn="", bool fInboundIn=false)
 
 ~CNode ()
 
 CNode (const CNode &)=delete
 
CNodeoperator= (const CNode &)=delete
 
NodeId GetId () const
 
uint64_t GetLocalNonce () const
 
int GetMyStartingHeight () const
 
int GetRefCount () const
 
bool ReceiveMsgBytes (const char *pch, unsigned int nBytes, bool &complete)
 
void SetRecvVersion (int nVersionIn)
 
int GetRecvVersion () const
 
void SetSendVersion (int nVersionIn)
 
int GetSendVersion () const
 
CService GetAddrLocal () const
 
void SetAddrLocal (const CService &addrLocalIn)
 May not be called more than once. More...
 
CNodeAddRef ()
 
void Release ()
 
void AddAddressKnown (const CAddress &_addr)
 
void PushAddress (const CAddress &_addr, FastRandomContext &insecure_rand)
 
void AddInventoryKnown (const CInv &inv)
 
void PushInventory (const CInv &inv)
 
void PushBlockHash (const uint256 &hash)
 
void CloseSocketDisconnect ()
 
void copyStats (CNodeStats &stats)
 
ServiceFlags GetLocalServices () const
 
std::string GetAddrName () const
 
void MaybeSetAddrName (const std::string &addrNameIn)
 Sets the addrName only if it was not previously set. More...
 

Public Attributes

std::atomic< ServiceFlagsnServices {NODE_NONE}
 
size_t nSendSize {0}
 
size_t nSendOffset {0}
 
CCriticalSection cs_vSend
 
CCriticalSection cs_hSocket
 
CCriticalSection cs_vRecv
 
CCriticalSection cs_vProcessMsg
 
size_t nProcessQueueSize {0}
 
CCriticalSection cs_sendProcessing
 
std::deque< CInvvRecvGetData
 
std::atomic< int > nRecvVersion {INIT_PROTO_VERSION}
 
std::atomic< int64_t > nLastSend {0}
 
std::atomic< int64_t > nLastRecv {0}
 
const int64_t nTimeConnected
 
std::atomic< int64_t > nTimeOffset {0}
 
const CAddress addr
 
const CAddress addrBind
 
std::atomic< int > nVersion {0}
 
CCriticalSection cs_SubVer
 
bool m_prefer_evict {false}
 
bool fWhitelisted {false}
 
bool fFeeler {false}
 
bool fOneShot {false}
 
bool m_manual_connection {false}
 
bool fClient {false}
 
bool m_limited_node {false}
 
const bool fInbound
 
std::atomic_bool fSuccessfullyConnected {false}
 
std::atomic_bool fDisconnect {false}
 
bool fSentAddr {false}
 
CSemaphoreGrant grantOutbound
 
CCriticalSection cs_filter
 
std::atomic< int > nRefCount {0}
 
const uint64_t nKeyedNetGroup
 
std::atomic_bool fPauseRecv {false}
 
std::atomic_bool fPauseSend {false}
 
uint256 hashContinue
 
std::atomic< int > nStartingHeight {-1}
 
std::vector< CAddressvAddrToSend
 
CRollingBloomFilter addrKnown
 
bool fGetAddr {false}
 
std::set< uint256setKnown
 
std::set< uint256setInventoryTxToSend
 
CCriticalSection cs_inventory
 
int64_t nNextInvSend {0}
 
std::atomic< int64_t > timeLastMempoolReq {0}
 
std::atomic< int64_t > nLastBlockTime {0}
 
std::atomic< int64_t > nLastTXTime {0}
 
std::atomic< uint64_t > nPingNonceSent {0}
 
std::atomic< int64_t > nPingUsecStart {0}
 
std::atomic< int64_t > nPingUsecTime {0}
 
std::atomic< int64_t > nMinPingUsecTime {std::numeric_limits<int64_t>::max()}
 
std::atomic< bool > fPingQueued {false}
 
CCriticalSection cs_feeFilter
 
CAmount lastSentFeeFilter {0}
 
int64_t nextSendTimeFeeFilter {0}
 

Protected Member Functions

mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY (cs_vRecv)
 

Protected Attributes

mapMsgCmdSize mapSendBytesPerMsgCmd
 

Private Member Functions

std::string addrName GUARDED_BY (cs_addrName)
 
CService addrLocal GUARDED_BY (cs_addrLocal)
 

Private Attributes

const NodeId id
 
const uint64_t nLocalHostNonce
 
const ServiceFlags nLocalServices
 
const int nMyStartingHeight
 
int nSendVersion {0}
 
std::list< CNetMessagevRecvMsg
 
CCriticalSection cs_addrName
 
CCriticalSection cs_addrLocal
 

Friends

class CConnman
 

Detailed Description

Information about a peer.

Definition at line 619 of file net.h.

Constructor & Destructor Documentation

◆ CNode() [1/2]

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

Definition at line 2615 of file net.cpp.

Here is the call graph for this function:

◆ ~CNode()

CNode::~CNode ( )

Definition at line 2646 of file net.cpp.

Here is the call graph for this function:

◆ CNode() [2/2]

CNode::CNode ( const CNode )
delete

Member Function Documentation

◆ AddAddressKnown()

void CNode::AddAddressKnown ( const CAddress _addr)
inline

Definition at line 812 of file net.h.

Here is the call graph for this function:

◆ AddInventoryKnown()

void CNode::AddInventoryKnown ( const CInv inv)
inline

Definition at line 832 of file net.h.

◆ AddRef()

CNode* CNode::AddRef ( )
inline

Definition at line 799 of file net.h.

◆ CloseSocketDisconnect()

void CNode::CloseSocketDisconnect ( )

Definition at line 447 of file net.cpp.

◆ copyStats()

void CNode::copyStats ( CNodeStats stats)

Definition at line 494 of file net.cpp.

Here is the call graph for this function:

◆ GetAddrLocal()

CService CNode::GetAddrLocal ( ) const

Definition at line 478 of file net.cpp.

Here is the caller graph for this function:

◆ GetAddrName()

std::string CNode::GetAddrName ( ) const

Definition at line 466 of file net.cpp.

Here is the caller graph for this function:

◆ GetId()

NodeId CNode::GetId ( ) const
inline

Definition at line 764 of file net.h.

Here is the caller graph for this function:

◆ GetLocalNonce()

uint64_t CNode::GetLocalNonce ( ) const
inline

Definition at line 768 of file net.h.

◆ GetLocalServices()

ServiceFlags CNode::GetLocalServices ( ) const
inline

Definition at line 862 of file net.h.

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

◆ GetMyStartingHeight()

int CNode::GetMyStartingHeight ( ) const
inline

Definition at line 772 of file net.h.

◆ GetRecvVersion()

int CNode::GetRecvVersion ( ) const
inline

Definition at line 788 of file net.h.

◆ GetRefCount()

int CNode::GetRefCount ( ) const
inline

Definition at line 776 of file net.h.

◆ GetSendVersion()

int CNode::GetSendVersion ( ) const

Definition at line 620 of file net.cpp.

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

◆ GUARDED_BY() [1/18]

SOCKET hSocket CNode::GUARDED_BY ( cs_hSocket  )

◆ GUARDED_BY() [2/18]

uint64_t nSendBytes CNode::GUARDED_BY ( cs_vSend  )
inline

Definition at line 628 of file net.h.

Here is the call graph for this function:

◆ GUARDED_BY() [3/18]

std::deque<std::vector<unsigned char> > vSendMsg CNode::GUARDED_BY ( cs_vSend  )

◆ GUARDED_BY() [4/18]

std::list<CNetMessage> vProcessMsg CNode::GUARDED_BY ( cs_vProcessMsg  )

◆ GUARDED_BY() [5/18]

uint64_t nRecvBytes CNode::GUARDED_BY ( cs_vRecv  )
inline

Definition at line 641 of file net.h.

◆ GUARDED_BY() [6/18]

std::string strSubVer CNode::GUARDED_BY ( cs_SubVer  )

◆ GUARDED_BY() [7/18]

std::string strSubVer cleanSubVer CNode::GUARDED_BY ( cs_SubVer  )

◆ GUARDED_BY() [8/18]

bool fRelayTxes CNode::GUARDED_BY ( cs_filter  )
inline

Definition at line 675 of file net.h.

◆ GUARDED_BY() [9/18]

mapMsgCmdSize mapRecvBytesPerMsgCmd CNode::GUARDED_BY ( cs_vRecv  )
protected

◆ GUARDED_BY() [10/18]

int64_t nNextAddrSend CNode::GUARDED_BY ( cs_sendProcessing  )
inline

Definition at line 699 of file net.h.

◆ GUARDED_BY() [11/18]

int64_t nNextLocalAddrSend CNode::GUARDED_BY ( cs_sendProcessing  )
inline

Definition at line 700 of file net.h.

Here is the call graph for this function:

◆ GUARDED_BY() [12/18]

CRollingBloomFilter filterInventoryKnown CNode::GUARDED_BY ( cs_inventory  )

◆ GUARDED_BY() [13/18]

std::vector<uint256> vInventoryBlockToSend CNode::GUARDED_BY ( cs_inventory  )

◆ GUARDED_BY() [14/18]

std::vector<uint256> vBlockHashesToAnnounce CNode::GUARDED_BY ( cs_inventory  )

◆ GUARDED_BY() [15/18]

bool fSendMempool CNode::GUARDED_BY ( cs_inventory  )
inline

Definition at line 716 of file net.h.

◆ GUARDED_BY() [16/18]

CAmount minFeeFilter CNode::GUARDED_BY ( cs_feeFilter  )
inline

Definition at line 737 of file net.h.

◆ GUARDED_BY() [17/18]

std::string addrName CNode::GUARDED_BY ( cs_addrName  )
private

◆ GUARDED_BY() [18/18]

CService addrLocal CNode::GUARDED_BY ( cs_addrLocal  )
private

◆ MaybeSetAddrName()

void CNode::MaybeSetAddrName ( const std::string &  addrNameIn)

Sets the addrName only if it was not previously set.

Definition at line 471 of file net.cpp.

◆ operator=()

CNode& CNode::operator= ( const CNode )
delete

◆ PT_GUARDED_BY()

std::unique_ptr<CBloomFilter> pfilter CNode::PT_GUARDED_BY ( cs_filter  )

◆ PushAddress()

void CNode::PushAddress ( const CAddress _addr,
FastRandomContext insecure_rand 
)
inline

Definition at line 817 of file net.h.

Here is the call graph for this function:

◆ PushBlockHash()

void CNode::PushBlockHash ( const uint256 hash)
inline

Definition at line 852 of file net.h.

◆ PushInventory()

void CNode::PushInventory ( const CInv inv)
inline

Definition at line 840 of file net.h.

Here is the caller graph for this function:

◆ ReceiveMsgBytes()

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

Definition at line 555 of file net.cpp.

Here is the call graph for this function:

◆ Release()

void CNode::Release ( )
inline

Definition at line 805 of file net.h.

◆ SetAddrLocal()

void CNode::SetAddrLocal ( const CService addrLocalIn)

May not be called more than once.

Definition at line 483 of file net.cpp.

Here is the call graph for this function:

◆ SetRecvVersion()

void CNode::SetRecvVersion ( int  nVersionIn)
inline

Definition at line 784 of file net.h.

◆ SetSendVersion()

void CNode::SetSendVersion ( int  nVersionIn)

Definition at line 606 of file net.cpp.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ CConnman

friend class CConnman
friend

Definition at line 621 of file net.h.

Member Data Documentation

◆ addr

const CAddress CNode::addr

Definition at line 649 of file net.h.

◆ addrBind

const CAddress CNode::addrBind

Definition at line 651 of file net.h.

◆ addrKnown

CRollingBloomFilter CNode::addrKnown

Definition at line 696 of file net.h.

◆ cs_addrLocal

CCriticalSection CNode::cs_addrLocal
mutableprivate

Definition at line 761 of file net.h.

◆ cs_addrName

CCriticalSection CNode::cs_addrName
mutableprivate

Definition at line 756 of file net.h.

◆ cs_feeFilter

CCriticalSection CNode::cs_feeFilter

Definition at line 737 of file net.h.

◆ cs_filter

CCriticalSection CNode::cs_filter
mutable

Definition at line 678 of file net.h.

◆ cs_hSocket

CCriticalSection CNode::cs_hSocket

Definition at line 631 of file net.h.

◆ cs_inventory

CCriticalSection CNode::cs_inventory

Definition at line 711 of file net.h.

◆ cs_sendProcessing

CCriticalSection CNode::cs_sendProcessing

Definition at line 638 of file net.h.

◆ cs_SubVer

CCriticalSection CNode::cs_SubVer

Definition at line 658 of file net.h.

◆ cs_vProcessMsg

CCriticalSection CNode::cs_vProcessMsg

Definition at line 634 of file net.h.

◆ cs_vRecv

CCriticalSection CNode::cs_vRecv

Definition at line 632 of file net.h.

◆ cs_vSend

CCriticalSection CNode::cs_vSend

Definition at line 630 of file net.h.

◆ fClient

bool CNode::fClient {false}

Definition at line 664 of file net.h.

◆ fDisconnect

std::atomic_bool CNode::fDisconnect {false}

Definition at line 670 of file net.h.

◆ fFeeler

bool CNode::fFeeler {false}

Definition at line 661 of file net.h.

◆ fGetAddr

bool CNode::fGetAddr {false}

Definition at line 697 of file net.h.

◆ fInbound

const bool CNode::fInbound

Definition at line 666 of file net.h.

◆ fOneShot

bool CNode::fOneShot {false}

Definition at line 662 of file net.h.

◆ fPauseRecv

std::atomic_bool CNode::fPauseRecv {false}

Definition at line 683 of file net.h.

◆ fPauseSend

std::atomic_bool CNode::fPauseSend {false}

Definition at line 684 of file net.h.

◆ fPingQueued

std::atomic<bool> CNode::fPingQueued {false}

Definition at line 735 of file net.h.

◆ fSentAddr

bool CNode::fSentAddr {false}

Definition at line 676 of file net.h.

◆ fSuccessfullyConnected

std::atomic_bool CNode::fSuccessfullyConnected {false}

Definition at line 667 of file net.h.

◆ fWhitelisted

bool CNode::fWhitelisted {false}

Definition at line 660 of file net.h.

◆ grantOutbound

CSemaphoreGrant CNode::grantOutbound

Definition at line 677 of file net.h.

◆ hashContinue

uint256 CNode::hashContinue

Definition at line 691 of file net.h.

◆ id

const NodeId CNode::id
private

Definition at line 748 of file net.h.

◆ lastSentFeeFilter

CAmount CNode::lastSentFeeFilter {0}

Definition at line 739 of file net.h.

◆ m_limited_node

bool CNode::m_limited_node {false}

Definition at line 665 of file net.h.

◆ m_manual_connection

bool CNode::m_manual_connection {false}

Definition at line 663 of file net.h.

◆ m_prefer_evict

bool CNode::m_prefer_evict {false}

Definition at line 659 of file net.h.

◆ mapSendBytesPerMsgCmd

mapMsgCmdSize CNode::mapSendBytesPerMsgCmd
protected

Definition at line 687 of file net.h.

◆ nextSendTimeFeeFilter

int64_t CNode::nextSendTimeFeeFilter {0}

Definition at line 740 of file net.h.

◆ nKeyedNetGroup

const uint64_t CNode::nKeyedNetGroup

Definition at line 682 of file net.h.

◆ nLastBlockTime

std::atomic<int64_t> CNode::nLastBlockTime {0}

Definition at line 722 of file net.h.

◆ nLastRecv

std::atomic<int64_t> CNode::nLastRecv {0}

Definition at line 645 of file net.h.

◆ nLastSend

std::atomic<int64_t> CNode::nLastSend {0}

Definition at line 644 of file net.h.

◆ nLastTXTime

std::atomic<int64_t> CNode::nLastTXTime {0}

Definition at line 723 of file net.h.

◆ nLocalHostNonce

const uint64_t CNode::nLocalHostNonce
private

Definition at line 749 of file net.h.

◆ nLocalServices

const ServiceFlags CNode::nLocalServices
private

Definition at line 751 of file net.h.

◆ nMinPingUsecTime

std::atomic<int64_t> CNode::nMinPingUsecTime {std::numeric_limits<int64_t>::max()}

Definition at line 733 of file net.h.

◆ nMyStartingHeight

const int CNode::nMyStartingHeight
private

Definition at line 752 of file net.h.

◆ nNextInvSend

int64_t CNode::nNextInvSend {0}

Definition at line 712 of file net.h.

◆ nPingNonceSent

std::atomic<uint64_t> CNode::nPingNonceSent {0}

Definition at line 727 of file net.h.

◆ nPingUsecStart

std::atomic<int64_t> CNode::nPingUsecStart {0}

Definition at line 729 of file net.h.

◆ nPingUsecTime

std::atomic<int64_t> CNode::nPingUsecTime {0}

Definition at line 731 of file net.h.

◆ nProcessQueueSize

size_t CNode::nProcessQueueSize {0}

Definition at line 636 of file net.h.

◆ nRecvVersion

std::atomic<int> CNode::nRecvVersion {INIT_PROTO_VERSION}

Definition at line 642 of file net.h.

◆ nRefCount

std::atomic<int> CNode::nRefCount {0}

Definition at line 680 of file net.h.

◆ nSendOffset

size_t CNode::nSendOffset {0}

Definition at line 627 of file net.h.

◆ nSendSize

size_t CNode::nSendSize {0}

Definition at line 626 of file net.h.

◆ nSendVersion

int CNode::nSendVersion {0}
private

Definition at line 753 of file net.h.

◆ nServices

std::atomic<ServiceFlags> CNode::nServices {NODE_NONE}

Definition at line 624 of file net.h.

◆ nStartingHeight

std::atomic<int> CNode::nStartingHeight {-1}

Definition at line 692 of file net.h.

◆ nTimeConnected

const int64_t CNode::nTimeConnected

Definition at line 646 of file net.h.

◆ nTimeOffset

std::atomic<int64_t> CNode::nTimeOffset {0}

Definition at line 647 of file net.h.

◆ nVersion

std::atomic<int> CNode::nVersion {0}

Definition at line 652 of file net.h.

◆ setInventoryTxToSend

std::set<uint256> CNode::setInventoryTxToSend

Definition at line 706 of file net.h.

◆ setKnown

std::set<uint256> CNode::setKnown

Definition at line 698 of file net.h.

◆ timeLastMempoolReq

std::atomic<int64_t> CNode::timeLastMempoolReq {0}

Definition at line 719 of file net.h.

◆ vAddrToSend

std::vector<CAddress> CNode::vAddrToSend

Definition at line 695 of file net.h.

◆ vRecvGetData

std::deque<CInv> CNode::vRecvGetData

Definition at line 640 of file net.h.

◆ vRecvMsg

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

Definition at line 754 of file net.h.


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