Bitcoin
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
CNode Class Reference

#include <net.h>

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 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_tnLastSend {0}
 
std::atomic< int64_tnLastRecv {0}
 
const int64_t nTimeConnected
 
std::atomic< int64_tnTimeOffset {0}
 
const CAddress addr
 
const CAddress addrBind
 
std::atomic< int > nVersion {0}
 
RecursiveMutex 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_ttimeLastMempoolReq {0}
 
std::atomic< int64_tnLastBlockTime {0}
 
std::atomic< int64_tnLastTXTime {0}
 
std::atomic< uint64_tnPingNonceSent {0}
 
std::atomic< int64_tnPingUsecStart {0}
 
std::atomic< int64_tnPingUsecTime {0}
 
std::atomic< int64_tnMinPingUsecTime {std::numeric_limits<int64_t>::max()}
 
std::atomic< bool > fPingQueued {false}
 
CCriticalSection cs_feeFilter
 
CAmount lastSentFeeFilter {0}
 
int64_t nextSendTimeFeeFilter {0}
 
std::set< uint256orphan_work_set
 

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

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 
)

◆ ~CNode()

CNode::~CNode ( )

◆ CNode() [2/2]

CNode::CNode ( const CNode )
delete

Member Function Documentation

◆ AddAddressKnown()

void CNode::AddAddressKnown ( const CAddress _addr)
inline

◆ AddInventoryKnown()

void CNode::AddInventoryKnown ( const CInv inv)
inline

◆ AddRef()

CNode* CNode::AddRef ( )
inline

◆ CloseSocketDisconnect()

void CNode::CloseSocketDisconnect ( )

◆ copyStats()

void CNode::copyStats ( CNodeStats stats)

◆ GetAddrLocal()

CService CNode::GetAddrLocal ( ) const

◆ GetAddrName()

std::string CNode::GetAddrName ( ) const

◆ GetId()

NodeId CNode::GetId ( ) const
inline

◆ GetLocalNonce()

uint64_t CNode::GetLocalNonce ( ) const
inline

◆ GetLocalServices()

ServiceFlags CNode::GetLocalServices ( ) const
inline

◆ GetMyStartingHeight()

int CNode::GetMyStartingHeight ( ) const
inline

◆ GetRecvVersion()

int CNode::GetRecvVersion ( ) const
inline

◆ GetRefCount()

int CNode::GetRefCount ( ) const
inline

◆ GetSendVersion()

int CNode::GetSendVersion ( ) const

◆ GUARDED_BY() [1/17]

SOCKET hSocket CNode::GUARDED_BY ( cs_hSocket  )

◆ GUARDED_BY() [2/17]

uint64_t nSendBytes CNode::GUARDED_BY ( cs_vSend  )
inline

◆ GUARDED_BY() [3/17]

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

◆ GUARDED_BY() [4/17]

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

◆ GUARDED_BY() [5/17]

uint64_t nRecvBytes CNode::GUARDED_BY ( cs_vRecv  )
inline

◆ GUARDED_BY() [6/17]

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

cleanSubVer is a sanitized string of the user agent byte array we read from the wire. This cleaned string can safely be logged or displayed.

◆ GUARDED_BY() [7/17]

bool fRelayTxes CNode::GUARDED_BY ( cs_filter  )
inline

◆ GUARDED_BY() [8/17]

mapMsgCmdSize mapRecvBytesPerMsgCmd CNode::GUARDED_BY ( cs_vRecv  )
protected

◆ GUARDED_BY() [9/17]

int64_t nNextAddrSend CNode::GUARDED_BY ( cs_sendProcessing  )
inline

◆ GUARDED_BY() [10/17]

int64_t nNextLocalAddrSend CNode::GUARDED_BY ( cs_sendProcessing  )
inline

◆ GUARDED_BY() [11/17]

CRollingBloomFilter filterInventoryKnown CNode::GUARDED_BY ( cs_inventory  )

◆ GUARDED_BY() [12/17]

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

◆ GUARDED_BY() [13/17]

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

◆ GUARDED_BY() [14/17]

bool fSendMempool CNode::GUARDED_BY ( cs_inventory  )
inline

◆ GUARDED_BY() [15/17]

CAmount minFeeFilter CNode::GUARDED_BY ( cs_feeFilter  )
inline

◆ GUARDED_BY() [16/17]

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

◆ GUARDED_BY() [17/17]

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.

◆ 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

◆ PushBlockHash()

void CNode::PushBlockHash ( const uint256 hash)
inline

◆ PushInventory()

void CNode::PushInventory ( const CInv inv)
inline

◆ ReceiveMsgBytes()

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

◆ Release()

void CNode::Release ( )
inline

◆ SetAddrLocal()

void CNode::SetAddrLocal ( const CService addrLocalIn)

May not be called more than once.

◆ SetRecvVersion()

void CNode::SetRecvVersion ( int  nVersionIn)
inline

◆ SetSendVersion()

void CNode::SetSendVersion ( int  nVersionIn)

Friends And Related Function Documentation

◆ CConnman

friend class CConnman
friend

Member Data Documentation

◆ addr

const CAddress CNode::addr

◆ addrBind

const CAddress CNode::addrBind

◆ addrKnown

CRollingBloomFilter CNode::addrKnown

◆ cs_addrLocal

CCriticalSection CNode::cs_addrLocal
mutableprivate

◆ cs_addrName

CCriticalSection CNode::cs_addrName
mutableprivate

◆ cs_feeFilter

CCriticalSection CNode::cs_feeFilter

◆ cs_filter

CCriticalSection CNode::cs_filter
mutable

◆ cs_hSocket

CCriticalSection CNode::cs_hSocket

◆ cs_inventory

CCriticalSection CNode::cs_inventory

◆ cs_sendProcessing

CCriticalSection CNode::cs_sendProcessing

◆ cs_SubVer

RecursiveMutex CNode::cs_SubVer

◆ cs_vProcessMsg

CCriticalSection CNode::cs_vProcessMsg

◆ cs_vRecv

CCriticalSection CNode::cs_vRecv

◆ cs_vSend

CCriticalSection CNode::cs_vSend

◆ fClient

bool CNode::fClient {false}

◆ fDisconnect

std::atomic_bool CNode::fDisconnect {false}

◆ fFeeler

bool CNode::fFeeler {false}

◆ fGetAddr

bool CNode::fGetAddr {false}

◆ fInbound

const bool CNode::fInbound

◆ fOneShot

bool CNode::fOneShot {false}

◆ fPauseRecv

std::atomic_bool CNode::fPauseRecv {false}

◆ fPauseSend

std::atomic_bool CNode::fPauseSend {false}

◆ fPingQueued

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

◆ fSentAddr

bool CNode::fSentAddr {false}

◆ fSuccessfullyConnected

std::atomic_bool CNode::fSuccessfullyConnected {false}

◆ fWhitelisted

bool CNode::fWhitelisted {false}

◆ grantOutbound

CSemaphoreGrant CNode::grantOutbound

◆ hashContinue

uint256 CNode::hashContinue

◆ id

const NodeId CNode::id
private

◆ lastSentFeeFilter

CAmount CNode::lastSentFeeFilter {0}

◆ m_limited_node

bool CNode::m_limited_node {false}

◆ m_manual_connection

bool CNode::m_manual_connection {false}

◆ m_prefer_evict

bool CNode::m_prefer_evict {false}

◆ mapSendBytesPerMsgCmd

mapMsgCmdSize CNode::mapSendBytesPerMsgCmd
protected

◆ nextSendTimeFeeFilter

int64_t CNode::nextSendTimeFeeFilter {0}

◆ nKeyedNetGroup

const uint64_t CNode::nKeyedNetGroup

◆ nLastBlockTime

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

◆ nLastRecv

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

◆ nLastSend

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

◆ nLastTXTime

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

◆ nLocalHostNonce

const uint64_t CNode::nLocalHostNonce
private

◆ nLocalServices

const ServiceFlags CNode::nLocalServices
private

◆ nMinPingUsecTime

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

◆ nMyStartingHeight

const int CNode::nMyStartingHeight
private

◆ nNextInvSend

int64_t CNode::nNextInvSend {0}

◆ nPingNonceSent

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

◆ nPingUsecStart

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

◆ nPingUsecTime

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

◆ nProcessQueueSize

size_t CNode::nProcessQueueSize {0}

◆ nRecvVersion

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

◆ nRefCount

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

◆ nSendOffset

size_t CNode::nSendOffset {0}

◆ nSendSize

size_t CNode::nSendSize {0}

◆ nSendVersion

int CNode::nSendVersion {0}
private

◆ nServices

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

◆ nStartingHeight

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

◆ nTimeConnected

const int64_t CNode::nTimeConnected

◆ nTimeOffset

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

◆ nVersion

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

◆ orphan_work_set

std::set<uint256> CNode::orphan_work_set

◆ setInventoryTxToSend

std::set<uint256> CNode::setInventoryTxToSend

◆ setKnown

std::set<uint256> CNode::setKnown

◆ timeLastMempoolReq

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

◆ vAddrToSend

std::vector<CAddress> CNode::vAddrToSend

◆ vRecvGetData

std::deque<CInv> CNode::vRecvGetData

◆ vRecvMsg

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

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