Bitcoin Core  0.15.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:

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 AskFor (const CInv &inv)
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
size_t nSendSize
size_t nSendOffset
CCriticalSection cs_vSend
CCriticalSection cs_hSocket
CCriticalSection cs_vRecv
CCriticalSection cs_vProcessMsg
size_t nProcessQueueSize
CCriticalSection cs_sendProcessing
std::deque< CInvvRecvGetData
std::atomic< int > nRecvVersion
std::atomic< int64_t > nLastSend
std::atomic< int64_t > nLastRecv
const int64_t nTimeConnected
std::atomic< int64_t > nTimeOffset
const CAddress addr
const CAddress addrBind
std::atomic< int > nVersion
CCriticalSection cs_SubVer
bool fWhitelisted
bool fFeeler
bool fOneShot
bool m_manual_connection
bool fClient
bool m_limited_node
const bool fInbound
std::atomic_bool fSuccessfullyConnected
std::atomic_bool fDisconnect
bool fSentAddr
CSemaphoreGrant grantOutbound
CCriticalSection cs_filter
std::atomic< int > nRefCount
const uint64_t nKeyedNetGroup
std::atomic_bool fPauseRecv
std::atomic_bool fPauseSend
uint256 hashContinue
std::atomic< int > nStartingHeight
std::vector< CAddressvAddrToSend
CRollingBloomFilter addrKnown
bool fGetAddr
std::set< uint256setKnown
std::set< uint256setInventoryTxToSend
CCriticalSection cs_inventory
std::set< uint256setAskFor
std::multimap< int64_t, CInvmapAskFor
int64_t nNextInvSend
std::atomic< int64_t > timeLastMempoolReq
std::atomic< int64_t > nLastBlockTime
std::atomic< int64_t > nLastTXTime
std::atomic< uint64_t > nPingNonceSent
std::atomic< int64_t > nPingUsecStart
std::atomic< int64_t > nPingUsecTime
std::atomic< int64_t > nMinPingUsecTime
std::atomic< bool > fPingQueued
CCriticalSection cs_feeFilter
CAmount lastSentFeeFilter
int64_t nextSendTimeFeeFilter

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
std::list< CNetMessagevRecvMsg
CCriticalSection cs_addrName
CCriticalSection cs_addrLocal


class CConnman

Detailed Description

Information about a peer.

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

◆ ~CNode()

CNode::~CNode ( )

Definition at line 2785 of file net.cpp.

Here is the call graph for this function:

◆ CNode() [2/2]

CNode::CNode ( const CNode )

Member Function Documentation

◆ AddAddressKnown()

void CNode::AddAddressKnown ( const CAddress _addr)

Definition at line 826 of file net.h.

Here is the call graph for this function:

◆ AddInventoryKnown()

void CNode::AddInventoryKnown ( const CInv inv)

Definition at line 846 of file net.h.

◆ AddRef()

CNode* CNode::AddRef ( )

Definition at line 813 of file net.h.

◆ AskFor()

void CNode::AskFor ( const CInv inv)

Definition at line 2790 of file net.cpp.

◆ CloseSocketDisconnect()

void CNode::CloseSocketDisconnect ( )

Definition at line 487 of file net.cpp.

◆ copyStats()

void CNode::copyStats ( CNodeStats stats)

Definition at line 685 of file net.cpp.

Here is the call graph for this function:

◆ GetAddrLocal()

CService CNode::GetAddrLocal ( ) const

Definition at line 669 of file net.cpp.

Here is the caller graph for this function:

◆ GetAddrName()

std::string CNode::GetAddrName ( ) const

Definition at line 657 of file net.cpp.

Here is the caller graph for this function:

◆ GetId()

NodeId CNode::GetId ( ) const

Definition at line 778 of file net.h.

Here is the caller graph for this function:

◆ GetLocalNonce()

uint64_t CNode::GetLocalNonce ( ) const

Definition at line 782 of file net.h.

◆ GetLocalServices()

ServiceFlags CNode::GetLocalServices ( ) const

Definition at line 878 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

Definition at line 786 of file net.h.

◆ GetRecvVersion()

int CNode::GetRecvVersion ( ) const

Definition at line 802 of file net.h.

◆ GetRefCount()

int CNode::GetRefCount ( ) const

Definition at line 790 of file net.h.

◆ GetSendVersion()

int CNode::GetSendVersion ( ) const

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

◆ 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  )

◆ 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  )

◆ GUARDED_BY() [9/18]

mapMsgCmdSize mapRecvBytesPerMsgCmd CNode::GUARDED_BY ( cs_vRecv  )

◆ GUARDED_BY() [10/18]

int64_t nNextAddrSend CNode::GUARDED_BY ( cs_sendProcessing  )

◆ GUARDED_BY() [11/18]

int64_t nNextLocalAddrSend CNode::GUARDED_BY ( cs_sendProcessing  )

◆ 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  )

◆ GUARDED_BY() [16/18]

CAmount minFeeFilter CNode::GUARDED_BY ( cs_feeFilter  )

◆ GUARDED_BY() [17/18]

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

◆ GUARDED_BY() [18/18]

CService addrLocal CNode::GUARDED_BY ( cs_addrLocal  )

◆ MaybeSetAddrName()

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

Sets the addrName only if it was not previously set.

Definition at line 662 of file net.cpp.

◆ operator=()

CNode& CNode::operator= ( const CNode )


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

◆ PushAddress()

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

Definition at line 831 of file net.h.

Here is the call graph for this function:

◆ PushBlockHash()

void CNode::PushBlockHash ( const uint256 hash)

Definition at line 866 of file net.h.

◆ PushInventory()

void CNode::PushInventory ( const CInv inv)

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

Here is the call graph for this function:

◆ Release()

void CNode::Release ( )

Definition at line 819 of file net.h.

◆ SetAddrLocal()

void CNode::SetAddrLocal ( const CService addrLocalIn)

May not be called more than once.

Definition at line 674 of file net.cpp.

Here is the call graph for this function:

◆ SetRecvVersion()

void CNode::SetRecvVersion ( int  nVersionIn)

Definition at line 798 of file net.h.

◆ SetSendVersion()

void CNode::SetSendVersion ( int  nVersionIn)

Definition at line 798 of file net.cpp.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ CConnman

friend class CConnman

Definition at line 636 of file net.h.

Member Data Documentation

◆ addr

const CAddress CNode::addr

Definition at line 664 of file net.h.

◆ addrBind

const CAddress CNode::addrBind

Definition at line 666 of file net.h.

◆ addrKnown

CRollingBloomFilter CNode::addrKnown

Definition at line 708 of file net.h.

◆ cs_addrLocal

CCriticalSection CNode::cs_addrLocal

Definition at line 775 of file net.h.

◆ cs_addrName

CCriticalSection CNode::cs_addrName

Definition at line 770 of file net.h.

◆ cs_feeFilter

CCriticalSection CNode::cs_feeFilter

Definition at line 752 of file net.h.

◆ cs_filter

CCriticalSection CNode::cs_filter

Definition at line 690 of file net.h.

◆ cs_hSocket

CCriticalSection CNode::cs_hSocket

Definition at line 646 of file net.h.

◆ cs_inventory

CCriticalSection CNode::cs_inventory

Definition at line 723 of file net.h.

◆ cs_sendProcessing

CCriticalSection CNode::cs_sendProcessing

Definition at line 653 of file net.h.

◆ cs_SubVer

CCriticalSection CNode::cs_SubVer

Definition at line 673 of file net.h.

◆ cs_vProcessMsg

CCriticalSection CNode::cs_vProcessMsg

Definition at line 649 of file net.h.

◆ cs_vRecv

CCriticalSection CNode::cs_vRecv

Definition at line 647 of file net.h.

◆ cs_vSend

CCriticalSection CNode::cs_vSend

Definition at line 645 of file net.h.

◆ fClient

bool CNode::fClient

Definition at line 678 of file net.h.

◆ fDisconnect

std::atomic_bool CNode::fDisconnect

Definition at line 682 of file net.h.

◆ fFeeler

bool CNode::fFeeler

Definition at line 675 of file net.h.

◆ fGetAddr

bool CNode::fGetAddr

Definition at line 709 of file net.h.

◆ fInbound

const bool CNode::fInbound

Definition at line 680 of file net.h.

◆ fOneShot

bool CNode::fOneShot

Definition at line 676 of file net.h.

◆ fPauseRecv

std::atomic_bool CNode::fPauseRecv

Definition at line 695 of file net.h.

◆ fPauseSend

std::atomic_bool CNode::fPauseSend

Definition at line 696 of file net.h.

◆ fPingQueued

std::atomic<bool> CNode::fPingQueued

Definition at line 749 of file net.h.

◆ fSentAddr

bool CNode::fSentAddr

Definition at line 688 of file net.h.

◆ fSuccessfullyConnected

std::atomic_bool CNode::fSuccessfullyConnected

Definition at line 681 of file net.h.

◆ fWhitelisted

bool CNode::fWhitelisted

Definition at line 674 of file net.h.

◆ grantOutbound

CSemaphoreGrant CNode::grantOutbound

Definition at line 689 of file net.h.

◆ hashContinue

uint256 CNode::hashContinue

Definition at line 703 of file net.h.

◆ id

const NodeId CNode::id

Definition at line 762 of file net.h.

◆ lastSentFeeFilter

CAmount CNode::lastSentFeeFilter

Definition at line 753 of file net.h.

◆ m_limited_node

bool CNode::m_limited_node

Definition at line 679 of file net.h.

◆ m_manual_connection

bool CNode::m_manual_connection

Definition at line 677 of file net.h.

◆ mapAskFor

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

Definition at line 725 of file net.h.

◆ mapSendBytesPerMsgCmd

mapMsgCmdSize CNode::mapSendBytesPerMsgCmd

Definition at line 699 of file net.h.

◆ nextSendTimeFeeFilter

int64_t CNode::nextSendTimeFeeFilter

Definition at line 754 of file net.h.

◆ nKeyedNetGroup

const uint64_t CNode::nKeyedNetGroup

Definition at line 694 of file net.h.

◆ nLastBlockTime

std::atomic<int64_t> CNode::nLastBlockTime

Definition at line 736 of file net.h.

◆ nLastRecv

std::atomic<int64_t> CNode::nLastRecv

Definition at line 660 of file net.h.

◆ nLastSend

std::atomic<int64_t> CNode::nLastSend

Definition at line 659 of file net.h.

◆ nLastTXTime

std::atomic<int64_t> CNode::nLastTXTime

Definition at line 737 of file net.h.

◆ nLocalHostNonce

const uint64_t CNode::nLocalHostNonce

Definition at line 763 of file net.h.

◆ nLocalServices

const ServiceFlags CNode::nLocalServices

Definition at line 765 of file net.h.

◆ nMinPingUsecTime

std::atomic<int64_t> CNode::nMinPingUsecTime

Definition at line 747 of file net.h.

◆ nMyStartingHeight

const int CNode::nMyStartingHeight

Definition at line 766 of file net.h.

◆ nNextInvSend

int64_t CNode::nNextInvSend

Definition at line 726 of file net.h.

◆ nPingNonceSent

std::atomic<uint64_t> CNode::nPingNonceSent

Definition at line 741 of file net.h.

◆ nPingUsecStart

std::atomic<int64_t> CNode::nPingUsecStart

Definition at line 743 of file net.h.

◆ nPingUsecTime

std::atomic<int64_t> CNode::nPingUsecTime

Definition at line 745 of file net.h.

◆ nProcessQueueSize

size_t CNode::nProcessQueueSize

Definition at line 651 of file net.h.

◆ nRecvVersion

std::atomic<int> CNode::nRecvVersion

Definition at line 657 of file net.h.

◆ nRefCount

std::atomic<int> CNode::nRefCount

Definition at line 692 of file net.h.

◆ nSendOffset

size_t CNode::nSendOffset

Definition at line 642 of file net.h.

◆ nSendSize

size_t CNode::nSendSize

Definition at line 641 of file net.h.

◆ nSendVersion

int CNode::nSendVersion

Definition at line 767 of file net.h.

◆ nServices

std::atomic<ServiceFlags> CNode::nServices

Definition at line 639 of file net.h.

◆ nStartingHeight

std::atomic<int> CNode::nStartingHeight

Definition at line 704 of file net.h.

◆ nTimeConnected

const int64_t CNode::nTimeConnected

Definition at line 661 of file net.h.

◆ nTimeOffset

std::atomic<int64_t> CNode::nTimeOffset

Definition at line 662 of file net.h.

◆ nVersion

std::atomic<int> CNode::nVersion

Definition at line 667 of file net.h.

◆ setAskFor

std::set<uint256> CNode::setAskFor

Definition at line 724 of file net.h.

◆ setInventoryTxToSend

std::set<uint256> CNode::setInventoryTxToSend

Definition at line 718 of file net.h.

◆ setKnown

std::set<uint256> CNode::setKnown

Definition at line 710 of file net.h.

◆ timeLastMempoolReq

std::atomic<int64_t> CNode::timeLastMempoolReq

Definition at line 733 of file net.h.

◆ vAddrToSend

std::vector<CAddress> CNode::vAddrToSend

Definition at line 707 of file net.h.

◆ vRecvGetData

std::deque<CInv> CNode::vRecvGetData

Definition at line 655 of file net.h.

◆ vRecvMsg

std::list<CNetMessage> CNode::vRecvMsg

Definition at line 768 of file net.h.

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