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
 
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 595 of file net.h.

Constructor & Destructor Documentation

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 2699 of file net.cpp.

Here is the call graph for this function:

CNode::~CNode ( )

Definition at line 2771 of file net.cpp.

Here is the call graph for this function:

CNode::CNode ( const CNode )
delete

Member Function Documentation

void CNode::AddAddressKnown ( const CAddress _addr)
inline

Definition at line 787 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::AddInventoryKnown ( const CInv inv)
inline

Definition at line 807 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

CNode* CNode::AddRef ( )
inline

Definition at line 774 of file net.h.

Here is the caller graph for this function:

void CNode::AskFor ( const CInv inv)

Definition at line 2776 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::CloseSocketDisconnect ( )

Definition at line 475 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::copyStats ( CNodeStats stats)

Definition at line 666 of file net.cpp.

Here is the call graph for this function:

CService CNode::GetAddrLocal ( ) const

Definition at line 650 of file net.cpp.

Here is the caller graph for this function:

std::string CNode::GetAddrName ( ) const

Definition at line 638 of file net.cpp.

Here is the caller graph for this function:

NodeId CNode::GetId ( ) const
inline

Definition at line 739 of file net.h.

Here is the caller graph for this function:

uint64_t CNode::GetLocalNonce ( ) const
inline

Definition at line 743 of file net.h.

ServiceFlags CNode::GetLocalServices ( ) const
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:

int CNode::GetMyStartingHeight ( ) const
inline

Definition at line 747 of file net.h.

int CNode::GetRecvVersion ( ) const
inline

Definition at line 763 of file net.h.

Here is the caller graph for this function:

int CNode::GetRefCount ( ) const
inline

Definition at line 751 of file net.h.

int CNode::GetSendVersion ( ) const

Definition at line 789 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Sets the addrName only if it was not previously set.

Definition at line 643 of file net.cpp.

Here is the caller graph for this function:

CNode& CNode::operator= ( const CNode )
delete
void CNode::PushAddress ( const CAddress _addr,
FastRandomContext insecure_rand 
)
inline

Definition at line 792 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::PushBlockHash ( const uint256 hash)
inline

Definition at line 827 of file net.h.

void CNode::PushInventory ( const CInv inv)
inline

Definition at line 815 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 723 of file net.cpp.

Here is the call graph for this function:

void CNode::Release ( )
inline

Definition at line 780 of file net.h.

void CNode::SetAddrLocal ( const CService addrLocalIn)

May not be called more than once.

Definition at line 655 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::SetRecvVersion ( int  nVersionIn)
inline

Definition at line 759 of file net.h.

Here is the caller graph for this function:

void CNode::SetSendVersion ( int  nVersionIn)

Definition at line 775 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class CConnman
friend

Definition at line 597 of file net.h.

Member Data Documentation

const CAddress CNode::addr

Definition at line 625 of file net.h.

const CAddress CNode::addrBind

Definition at line 627 of file net.h.

CRollingBloomFilter CNode::addrKnown

Definition at line 668 of file net.h.

CService CNode::addrLocal
private

Definition at line 735 of file net.h.

std::string CNode::addrName
private

Definition at line 732 of file net.h.

std::string CNode::cleanSubVer

Definition at line 633 of file net.h.

CCriticalSection CNode::cs_addrLocal
mutableprivate

Definition at line 736 of file net.h.

CCriticalSection CNode::cs_addrName
mutableprivate

Definition at line 731 of file net.h.

CCriticalSection CNode::cs_feeFilter

Definition at line 713 of file net.h.

CCriticalSection CNode::cs_filter

Definition at line 650 of file net.h.

CCriticalSection CNode::cs_hSocket

Definition at line 607 of file net.h.

CCriticalSection CNode::cs_inventory

Definition at line 683 of file net.h.

CCriticalSection CNode::cs_sendProcessing

Definition at line 614 of file net.h.

CCriticalSection CNode::cs_SubVer

Definition at line 634 of file net.h.

CCriticalSection CNode::cs_vProcessMsg

Definition at line 610 of file net.h.

CCriticalSection CNode::cs_vRecv

Definition at line 608 of file net.h.

CCriticalSection CNode::cs_vSend

Definition at line 606 of file net.h.

bool CNode::fClient

Definition at line 639 of file net.h.

std::atomic_bool CNode::fDisconnect

Definition at line 642 of file net.h.

bool CNode::fFeeler

Definition at line 636 of file net.h.

bool CNode::fGetAddr

Definition at line 669 of file net.h.

CRollingBloomFilter CNode::filterInventoryKnown

Definition at line 675 of file net.h.

const bool CNode::fInbound

Definition at line 640 of file net.h.

bool CNode::fOneShot

Definition at line 637 of file net.h.

std::atomic_bool CNode::fPauseRecv

Definition at line 655 of file net.h.

std::atomic_bool CNode::fPauseSend

Definition at line 656 of file net.h.

std::atomic<bool> CNode::fPingQueued

Definition at line 710 of file net.h.

bool CNode::fRelayTxes

Definition at line 647 of file net.h.

bool CNode::fSendMempool

Definition at line 691 of file net.h.

bool CNode::fSentAddr

Definition at line 648 of file net.h.

std::atomic_bool CNode::fSuccessfullyConnected

Definition at line 641 of file net.h.

bool CNode::fWhitelisted

Definition at line 635 of file net.h.

CSemaphoreGrant CNode::grantOutbound

Definition at line 649 of file net.h.

uint256 CNode::hashContinue

Definition at line 663 of file net.h.

SOCKET CNode::hSocket

Definition at line 601 of file net.h.

const NodeId CNode::id
private

Definition at line 723 of file net.h.

CAmount CNode::lastSentFeeFilter

Definition at line 714 of file net.h.

bool CNode::m_manual_connection

Definition at line 638 of file net.h.

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

Definition at line 685 of file net.h.

mapMsgCmdSize CNode::mapRecvBytesPerMsgCmd
protected

Definition at line 660 of file net.h.

mapMsgCmdSize CNode::mapSendBytesPerMsgCmd
protected

Definition at line 659 of file net.h.

CAmount CNode::minFeeFilter

Definition at line 712 of file net.h.

int64_t CNode::nextSendTimeFeeFilter

Definition at line 715 of file net.h.

const uint64_t CNode::nKeyedNetGroup

Definition at line 654 of file net.h.

std::atomic<int64_t> CNode::nLastBlockTime

Definition at line 697 of file net.h.

std::atomic<int64_t> CNode::nLastRecv

Definition at line 621 of file net.h.

std::atomic<int64_t> CNode::nLastSend

Definition at line 620 of file net.h.

std::atomic<int64_t> CNode::nLastTXTime

Definition at line 698 of file net.h.

const uint64_t CNode::nLocalHostNonce
private

Definition at line 724 of file net.h.

const ServiceFlags CNode::nLocalServices
private

Definition at line 726 of file net.h.

std::atomic<int64_t> CNode::nMinPingUsecTime

Definition at line 708 of file net.h.

const int CNode::nMyStartingHeight
private

Definition at line 727 of file net.h.

int64_t CNode::nNextAddrSend

Definition at line 671 of file net.h.

int64_t CNode::nNextInvSend

Definition at line 686 of file net.h.

int64_t CNode::nNextLocalAddrSend

Definition at line 672 of file net.h.

std::atomic<uint64_t> CNode::nPingNonceSent

Definition at line 702 of file net.h.

std::atomic<int64_t> CNode::nPingUsecStart

Definition at line 704 of file net.h.

std::atomic<int64_t> CNode::nPingUsecTime

Definition at line 706 of file net.h.

size_t CNode::nProcessQueueSize

Definition at line 612 of file net.h.

uint64_t CNode::nRecvBytes

Definition at line 617 of file net.h.

std::atomic<int> CNode::nRecvVersion

Definition at line 618 of file net.h.

std::atomic<int> CNode::nRefCount

Definition at line 652 of file net.h.

uint64_t CNode::nSendBytes

Definition at line 604 of file net.h.

size_t CNode::nSendOffset

Definition at line 603 of file net.h.

size_t CNode::nSendSize

Definition at line 602 of file net.h.

int CNode::nSendVersion
private

Definition at line 728 of file net.h.

std::atomic<ServiceFlags> CNode::nServices

Definition at line 600 of file net.h.

std::atomic<int> CNode::nStartingHeight

Definition at line 664 of file net.h.

const int64_t CNode::nTimeConnected

Definition at line 622 of file net.h.

std::atomic<int64_t> CNode::nTimeOffset

Definition at line 623 of file net.h.

std::atomic<int> CNode::nVersion

Definition at line 628 of file net.h.

std::unique_ptr<CBloomFilter> CNode::pfilter

Definition at line 651 of file net.h.

std::set<uint256> CNode::setAskFor

Definition at line 684 of file net.h.

std::set<uint256> CNode::setInventoryTxToSend

Definition at line 678 of file net.h.

std::set<uint256> CNode::setKnown

Definition at line 670 of file net.h.

std::string CNode::strSubVer

Definition at line 633 of file net.h.

std::atomic<int64_t> CNode::timeLastMempoolReq

Definition at line 694 of file net.h.

std::vector<CAddress> CNode::vAddrToSend

Definition at line 667 of file net.h.

std::vector<uint256> CNode::vBlockHashesToAnnounce

Definition at line 689 of file net.h.

std::vector<uint256> CNode::vInventoryBlockToSend

Definition at line 682 of file net.h.

std::list<CNetMessage> CNode::vProcessMsg

Definition at line 611 of file net.h.

std::deque<CInv> CNode::vRecvGetData

Definition at line 616 of file net.h.

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

Definition at line 729 of file net.h.

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

Definition at line 605 of file net.h.


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