Bitcoin Core  0.15.99
P2P Digital Currency
Public Member Functions | Public Attributes | Protected Attributes | 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

 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
 
SOCKET hSocket
 
size_t nSendSize
 
size_t nSendOffset
 
uint64_t nSendBytes
 
std::deque< std::vector< unsigned char > > vSendMsg
 
CCriticalSection cs_vSend
 
CCriticalSection cs_hSocket
 
CCriticalSection cs_vRecv
 
CCriticalSection cs_vProcessMsg
 
std::list< CNetMessagevProcessMsg
 
size_t nProcessQueueSize
 
CCriticalSection cs_sendProcessing
 
std::deque< CInvvRecvGetData
 
uint64_t nRecvBytes
 
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
 
std::string strSubVer
 
std::string cleanSubVer
 
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 fRelayTxes
 
bool fSentAddr
 
CSemaphoreGrant grantOutbound
 
CCriticalSection cs_filter
 
std::unique_ptr< CBloomFilterpfilter
 
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
 
int64_t nNextAddrSend
 
int64_t nNextLocalAddrSend
 
CRollingBloomFilter filterInventoryKnown
 
std::set< uint256setInventoryTxToSend
 
std::vector< uint256vInventoryBlockToSend
 
CCriticalSection cs_inventory
 
std::set< uint256setAskFor
 
std::multimap< int64_t, CInvmapAskFor
 
int64_t nNextInvSend
 
std::vector< uint256vBlockHashesToAnnounce
 
bool fSendMempool
 
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
 
CAmount minFeeFilter
 
CCriticalSection cs_feeFilter
 
CAmount lastSentFeeFilter
 
int64_t nextSendTimeFeeFilter
 

Protected Attributes

mapMsgCmdSize mapSendBytesPerMsgCmd
 
mapMsgCmdSize mapRecvBytesPerMsgCmd
 

Private Attributes

const NodeId id
 
const uint64_t nLocalHostNonce
 
const ServiceFlags nLocalServices
 
const int nMyStartingHeight
 
int nSendVersion
 
std::list< CNetMessagevRecvMsg
 
CCriticalSection cs_addrName
 
std::string addrName
 
CService addrLocal
 
CCriticalSection cs_addrLocal
 

Friends

class CConnman
 

Detailed Description

Information about a peer.

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

◆ ~CNode()

CNode::~CNode ( )

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

Here is the call graph for this function:

◆ AddInventoryKnown()

void CNode::AddInventoryKnown ( const CInv inv)
inline

Definition at line 831 of file net.h.

Here is the call graph for this function:

◆ AddRef()

CNode* CNode::AddRef ( )
inline

Definition at line 798 of file net.h.

◆ AskFor()

void CNode::AskFor ( const CInv inv)

Definition at line 2781 of file net.cpp.

◆ CloseSocketDisconnect()

void CNode::CloseSocketDisconnect ( )

Definition at line 486 of file net.cpp.

◆ copyStats()

void CNode::copyStats ( CNodeStats stats)

Definition at line 684 of file net.cpp.

Here is the call graph for this function:

◆ GetAddrLocal()

CService CNode::GetAddrLocal ( ) const

Definition at line 668 of file net.cpp.

Here is the caller graph for this function:

◆ GetAddrName()

std::string CNode::GetAddrName ( ) const

Definition at line 656 of file net.cpp.

Here is the caller graph for this function:

◆ GetId()

NodeId CNode::GetId ( ) const
inline

Definition at line 763 of file net.h.

Here is the caller graph for this function:

◆ GetLocalNonce()

uint64_t CNode::GetLocalNonce ( ) const
inline

Definition at line 767 of file net.h.

◆ GetLocalServices()

ServiceFlags CNode::GetLocalServices ( ) const
inline

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

◆ GetRecvVersion()

int CNode::GetRecvVersion ( ) const
inline

Definition at line 787 of file net.h.

◆ GetRefCount()

int CNode::GetRefCount ( ) const
inline

Definition at line 775 of file net.h.

◆ GetSendVersion()

int CNode::GetSendVersion ( ) const

Definition at line 808 of file net.cpp.

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

◆ MaybeSetAddrName()

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

Sets the addrName only if it was not previously set.

Definition at line 661 of file net.cpp.

◆ operator=()

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

◆ PushAddress()

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

Definition at line 816 of file net.h.

Here is the call graph for this function:

◆ PushBlockHash()

void CNode::PushBlockHash ( const uint256 hash)
inline

Definition at line 851 of file net.h.

◆ PushInventory()

void CNode::PushInventory ( const CInv inv)
inline

Definition at line 839 of file net.h.

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

◆ ReceiveMsgBytes()

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

Definition at line 742 of file net.cpp.

Here is the call graph for this function:

◆ Release()

void CNode::Release ( )
inline

Definition at line 804 of file net.h.

◆ SetAddrLocal()

void CNode::SetAddrLocal ( const CService addrLocalIn)

May not be called more than once.

Definition at line 673 of file net.cpp.

Here is the call graph for this function:

◆ SetRecvVersion()

void CNode::SetRecvVersion ( int  nVersionIn)
inline

Definition at line 783 of file net.h.

◆ SetSendVersion()

void CNode::SetSendVersion ( int  nVersionIn)

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

Member Data Documentation

◆ addr

const CAddress CNode::addr

Definition at line 648 of file net.h.

◆ addrBind

const CAddress CNode::addrBind

Definition at line 650 of file net.h.

◆ addrKnown

CRollingBloomFilter CNode::addrKnown

Definition at line 692 of file net.h.

◆ addrLocal

CService CNode::addrLocal
private

Definition at line 759 of file net.h.

◆ addrName

std::string CNode::addrName
private

Definition at line 756 of file net.h.

◆ cleanSubVer

std::string CNode::cleanSubVer

Definition at line 656 of file net.h.

◆ cs_addrLocal

CCriticalSection CNode::cs_addrLocal
mutableprivate

Definition at line 760 of file net.h.

◆ cs_addrName

CCriticalSection CNode::cs_addrName
mutableprivate

Definition at line 755 of file net.h.

◆ cs_feeFilter

CCriticalSection CNode::cs_feeFilter

Definition at line 737 of file net.h.

◆ cs_filter

CCriticalSection CNode::cs_filter

Definition at line 674 of file net.h.

◆ cs_hSocket

CCriticalSection CNode::cs_hSocket

Definition at line 630 of file net.h.

◆ cs_inventory

CCriticalSection CNode::cs_inventory

Definition at line 707 of file net.h.

◆ cs_sendProcessing

CCriticalSection CNode::cs_sendProcessing

Definition at line 637 of file net.h.

◆ cs_SubVer

CCriticalSection CNode::cs_SubVer

Definition at line 657 of file net.h.

◆ cs_vProcessMsg

CCriticalSection CNode::cs_vProcessMsg

Definition at line 633 of file net.h.

◆ cs_vRecv

CCriticalSection CNode::cs_vRecv

Definition at line 631 of file net.h.

◆ cs_vSend

CCriticalSection CNode::cs_vSend

Definition at line 629 of file net.h.

◆ fClient

bool CNode::fClient

Definition at line 662 of file net.h.

◆ fDisconnect

std::atomic_bool CNode::fDisconnect

Definition at line 666 of file net.h.

◆ fFeeler

bool CNode::fFeeler

Definition at line 659 of file net.h.

◆ fGetAddr

bool CNode::fGetAddr

Definition at line 693 of file net.h.

◆ filterInventoryKnown

CRollingBloomFilter CNode::filterInventoryKnown

Definition at line 699 of file net.h.

◆ fInbound

const bool CNode::fInbound

Definition at line 664 of file net.h.

◆ fOneShot

bool CNode::fOneShot

Definition at line 660 of file net.h.

◆ fPauseRecv

std::atomic_bool CNode::fPauseRecv

Definition at line 679 of file net.h.

◆ fPauseSend

std::atomic_bool CNode::fPauseSend

Definition at line 680 of file net.h.

◆ fPingQueued

std::atomic<bool> CNode::fPingQueued

Definition at line 734 of file net.h.

◆ fRelayTxes

bool CNode::fRelayTxes

Definition at line 671 of file net.h.

◆ fSendMempool

bool CNode::fSendMempool

Definition at line 715 of file net.h.

◆ fSentAddr

bool CNode::fSentAddr

Definition at line 672 of file net.h.

◆ fSuccessfullyConnected

std::atomic_bool CNode::fSuccessfullyConnected

Definition at line 665 of file net.h.

◆ fWhitelisted

bool CNode::fWhitelisted

Definition at line 658 of file net.h.

◆ grantOutbound

CSemaphoreGrant CNode::grantOutbound

Definition at line 673 of file net.h.

◆ hashContinue

uint256 CNode::hashContinue

Definition at line 687 of file net.h.

◆ hSocket

SOCKET CNode::hSocket

Definition at line 624 of file net.h.

◆ id

const NodeId CNode::id
private

Definition at line 747 of file net.h.

◆ lastSentFeeFilter

CAmount CNode::lastSentFeeFilter

Definition at line 738 of file net.h.

◆ m_limited_node

bool CNode::m_limited_node

Definition at line 663 of file net.h.

◆ m_manual_connection

bool CNode::m_manual_connection

Definition at line 661 of file net.h.

◆ mapAskFor

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

Definition at line 709 of file net.h.

◆ mapRecvBytesPerMsgCmd

mapMsgCmdSize CNode::mapRecvBytesPerMsgCmd
protected

Definition at line 684 of file net.h.

◆ mapSendBytesPerMsgCmd

mapMsgCmdSize CNode::mapSendBytesPerMsgCmd
protected

Definition at line 683 of file net.h.

◆ minFeeFilter

CAmount CNode::minFeeFilter

Definition at line 736 of file net.h.

◆ nextSendTimeFeeFilter

int64_t CNode::nextSendTimeFeeFilter

Definition at line 739 of file net.h.

◆ nKeyedNetGroup

const uint64_t CNode::nKeyedNetGroup

Definition at line 678 of file net.h.

◆ nLastBlockTime

std::atomic<int64_t> CNode::nLastBlockTime

Definition at line 721 of file net.h.

◆ nLastRecv

std::atomic<int64_t> CNode::nLastRecv

Definition at line 644 of file net.h.

◆ nLastSend

std::atomic<int64_t> CNode::nLastSend

Definition at line 643 of file net.h.

◆ nLastTXTime

std::atomic<int64_t> CNode::nLastTXTime

Definition at line 722 of file net.h.

◆ nLocalHostNonce

const uint64_t CNode::nLocalHostNonce
private

Definition at line 748 of file net.h.

◆ nLocalServices

const ServiceFlags CNode::nLocalServices
private

Definition at line 750 of file net.h.

◆ nMinPingUsecTime

std::atomic<int64_t> CNode::nMinPingUsecTime

Definition at line 732 of file net.h.

◆ nMyStartingHeight

const int CNode::nMyStartingHeight
private

Definition at line 751 of file net.h.

◆ nNextAddrSend

int64_t CNode::nNextAddrSend

Definition at line 695 of file net.h.

◆ nNextInvSend

int64_t CNode::nNextInvSend

Definition at line 710 of file net.h.

◆ nNextLocalAddrSend

int64_t CNode::nNextLocalAddrSend

Definition at line 696 of file net.h.

◆ nPingNonceSent

std::atomic<uint64_t> CNode::nPingNonceSent

Definition at line 726 of file net.h.

◆ nPingUsecStart

std::atomic<int64_t> CNode::nPingUsecStart

Definition at line 728 of file net.h.

◆ nPingUsecTime

std::atomic<int64_t> CNode::nPingUsecTime

Definition at line 730 of file net.h.

◆ nProcessQueueSize

size_t CNode::nProcessQueueSize

Definition at line 635 of file net.h.

◆ nRecvBytes

uint64_t CNode::nRecvBytes

Definition at line 640 of file net.h.

◆ nRecvVersion

std::atomic<int> CNode::nRecvVersion

Definition at line 641 of file net.h.

◆ nRefCount

std::atomic<int> CNode::nRefCount

Definition at line 676 of file net.h.

◆ nSendBytes

uint64_t CNode::nSendBytes

Definition at line 627 of file net.h.

◆ nSendOffset

size_t CNode::nSendOffset

Definition at line 626 of file net.h.

◆ nSendSize

size_t CNode::nSendSize

Definition at line 625 of file net.h.

◆ nSendVersion

int CNode::nSendVersion
private

Definition at line 752 of file net.h.

◆ nServices

std::atomic<ServiceFlags> CNode::nServices

Definition at line 623 of file net.h.

◆ nStartingHeight

std::atomic<int> CNode::nStartingHeight

Definition at line 688 of file net.h.

◆ nTimeConnected

const int64_t CNode::nTimeConnected

Definition at line 645 of file net.h.

◆ nTimeOffset

std::atomic<int64_t> CNode::nTimeOffset

Definition at line 646 of file net.h.

◆ nVersion

std::atomic<int> CNode::nVersion

Definition at line 651 of file net.h.

◆ pfilter

std::unique_ptr<CBloomFilter> CNode::pfilter

Definition at line 675 of file net.h.

◆ setAskFor

std::set<uint256> CNode::setAskFor

Definition at line 708 of file net.h.

◆ setInventoryTxToSend

std::set<uint256> CNode::setInventoryTxToSend

Definition at line 702 of file net.h.

◆ setKnown

std::set<uint256> CNode::setKnown

Definition at line 694 of file net.h.

◆ strSubVer

std::string CNode::strSubVer

Definition at line 656 of file net.h.

◆ timeLastMempoolReq

std::atomic<int64_t> CNode::timeLastMempoolReq

Definition at line 718 of file net.h.

◆ vAddrToSend

std::vector<CAddress> CNode::vAddrToSend

Definition at line 691 of file net.h.

◆ vBlockHashesToAnnounce

std::vector<uint256> CNode::vBlockHashesToAnnounce

Definition at line 713 of file net.h.

◆ vInventoryBlockToSend

std::vector<uint256> CNode::vInventoryBlockToSend

Definition at line 706 of file net.h.

◆ vProcessMsg

std::list<CNetMessage> CNode::vProcessMsg

Definition at line 634 of file net.h.

◆ vRecvGetData

std::deque<CInv> CNode::vRecvGetData

Definition at line 639 of file net.h.

◆ vRecvMsg

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

Definition at line 753 of file net.h.

◆ vSendMsg

std::deque<std::vector<unsigned char> > CNode::vSendMsg

Definition at line 628 of file net.h.


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