Information about a peer.
More...
#include <net.h>
|
SOCKET hSocket | GUARDED_BY (cs_hSocket) |
|
size_t nSendSize | GUARDED_BY (cs_vSend) |
| Total size of all vSendMsg entries. More...
|
|
size_t nSendOffset | GUARDED_BY (cs_vSend) |
| Offset inside the first vSendMsg already sent. More...
|
|
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) |
| cleanSubVer is a sanitized string of the user agent byte array we read from the wire. More...
|
|
bool | HasPermission (NetPermissionFlags permission) const |
|
bool | IsOutboundOrBlockRelayConn () const |
|
bool | IsFullOutboundConn () const |
|
bool | IsManualConn () const |
|
bool | IsBlockOnlyConn () const |
|
bool | IsFeelerConn () const |
|
bool | IsAddrFetchConn () const |
|
bool | IsInboundConn () const |
|
bool | ExpectServicesFromConn () const |
|
Network | ConnectedThroughNetwork () const |
| Get network the peer connected through. More...
|
|
| CNode (NodeId id, ServiceFlags nLocalServicesIn, SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const CAddress &addrBindIn, const std::string &addrNameIn, ConnectionType conn_type_in, bool inbound_onion) |
|
| ~CNode () |
|
| CNode (const CNode &)=delete |
|
CNode & | operator= (const CNode &)=delete |
|
NodeId | GetId () const |
|
uint64_t | GetLocalNonce () const |
|
int | GetRefCount () const |
|
bool | ReceiveMsgBytes (Span< const uint8_t > msg_bytes, bool &complete) |
| Receive bytes from the buffer and deserialize them into messages. More...
|
|
void | SetCommonVersion (int greatest_common_version) |
|
int | GetCommonVersion () const |
|
CService | GetAddrLocal () const |
|
void | SetAddrLocal (const CService &addrLocalIn) |
| May not be called more than once. More...
|
|
CNode * | AddRef () |
|
void | Release () |
|
void | AddKnownTx (const uint256 &hash) |
|
void | PushTxInventory (const uint256 &hash) |
|
void | CloseSocketDisconnect () |
|
void | CopyStats (CNodeStats &stats) |
|
ServiceFlags | GetLocalServices () const |
|
std::string | ConnectionTypeAsString () const |
|
void | PongReceived (std::chrono::microseconds ping_time) |
| A ping-pong round trip has completed successfully. More...
|
|
Information about a peer.
Definition at line 393 of file net.h.
◆ CNode() [1/2]
◆ ~CNode()
◆ CNode() [2/2]
CNode::CNode |
( |
const CNode & |
| ) |
|
|
delete |
◆ AddKnownTx()
void CNode::AddKnownTx |
( |
const uint256 & |
hash | ) |
|
|
inline |
◆ AddRef()
CNode * CNode::AddRef |
( |
| ) |
|
|
inline |
◆ CloseSocketDisconnect()
void CNode::CloseSocketDisconnect |
( |
| ) |
|
◆ ConnectedThroughNetwork()
Network CNode::ConnectedThroughNetwork |
( |
| ) |
const |
Get network the peer connected through.
Returns Network::NET_ONION for inbound onion connections, and CNetAddr::GetNetClass() otherwise. The latter cannot be used directly because it doesn't detect the former, and it's not the responsibility of the CNetAddr class to know the actual network a peer is connected through.
- Returns
- network the peer connected through.
Definition at line 568 of file net.cpp.
◆ ConnectionTypeAsString()
std::string CNode::ConnectionTypeAsString |
( |
| ) |
const |
|
inline |
◆ CopyStats()
◆ ExpectServicesFromConn()
bool CNode::ExpectServicesFromConn |
( |
| ) |
const |
|
inline |
◆ GetAddrLocal()
◆ GetCommonVersion()
int CNode::GetCommonVersion |
( |
| ) |
const |
|
inline |
◆ GetId()
◆ GetLocalNonce()
uint64_t CNode::GetLocalNonce |
( |
| ) |
const |
|
inline |
◆ GetLocalServices()
◆ GetRefCount()
int CNode::GetRefCount |
( |
| ) |
const |
|
inline |
◆ GUARDED_BY() [1/11]
◆ GUARDED_BY() [2/11]
◆ GUARDED_BY() [3/11]
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.
Definition at line 441 of file net.h.
◆ GUARDED_BY() [4/11]
◆ GUARDED_BY() [5/11]
uint64_t nRecvBytes CNode::GUARDED_BY |
( |
cs_vRecv |
| ) |
|
|
inline |
◆ GUARDED_BY() [6/11]
◆ GUARDED_BY() [7/11]
size_t nSendSize CNode::GUARDED_BY |
( |
cs_vSend |
| ) |
|
|
inline |
Total size of all vSendMsg entries.
Definition at line 406 of file net.h.
◆ GUARDED_BY() [8/11]
size_t nSendOffset CNode::GUARDED_BY |
( |
cs_vSend |
| ) |
|
|
inline |
Offset inside the first vSendMsg already sent.
Definition at line 408 of file net.h.
◆ GUARDED_BY() [9/11]
uint64_t nSendBytes CNode::GUARDED_BY |
( |
cs_vSend |
| ) |
|
|
inline |
◆ GUARDED_BY() [10/11]
std::deque< std::vector< unsigned char > > vSendMsg CNode::GUARDED_BY |
( |
cs_vSend |
| ) |
|
◆ GUARDED_BY() [11/11]
◆ HasPermission()
◆ IsAddrFetchConn()
bool CNode::IsAddrFetchConn |
( |
| ) |
const |
|
inline |
◆ IsBlockOnlyConn()
bool CNode::IsBlockOnlyConn |
( |
| ) |
const |
|
inline |
◆ IsFeelerConn()
bool CNode::IsFeelerConn |
( |
| ) |
const |
|
inline |
◆ IsFullOutboundConn()
bool CNode::IsFullOutboundConn |
( |
| ) |
const |
|
inline |
◆ IsInboundConn()
bool CNode::IsInboundConn |
( |
| ) |
const |
|
inline |
◆ IsManualConn()
bool CNode::IsManualConn |
( |
| ) |
const |
|
inline |
◆ IsOutboundOrBlockRelayConn()
bool CNode::IsOutboundOrBlockRelayConn |
( |
| ) |
const |
|
inline |
◆ operator=()
◆ PongReceived()
void CNode::PongReceived |
( |
std::chrono::microseconds |
ping_time | ) |
|
|
inline |
A ping-pong round trip has completed successfully.
Update latest and minimum ping times.
Definition at line 664 of file net.h.
◆ PushTxInventory()
void CNode::PushTxInventory |
( |
const uint256 & |
hash | ) |
|
|
inline |
◆ ReceiveMsgBytes()
bool CNode::ReceiveMsgBytes |
( |
Span< const uint8_t > |
msg_bytes, |
|
|
bool & |
complete |
|
) |
| |
Receive bytes from the buffer and deserialize them into messages.
- Parameters
-
[in] | msg_bytes | The raw data |
[out] | complete | Set True if at least one message has been deserialized and is ready to be processed |
- Returns
- True if the peer should stay connected, False if the peer should be disconnected from.
Definition at line 631 of file net.cpp.
◆ Release()
◆ SetAddrLocal()
void CNode::SetAddrLocal |
( |
const CService & |
addrLocalIn | ) |
|
May not be called more than once.
Definition at line 559 of file net.cpp.
◆ SetCommonVersion()
void CNode::SetCommonVersion |
( |
int |
greatest_common_version | ) |
|
|
inline |
◆ CConnman
◆ ConnmanTestMsg
◆ addr
◆ addrBind
◆ cs_addrLocal
◆ cs_hSocket
◆ cs_sendProcessing
◆ cs_SubVer
◆ cs_vProcessMsg
◆ cs_vRecv
◆ cs_vSend
◆ fClient
bool CNode::fClient {false} |
◆ fDisconnect
std::atomic_bool CNode::fDisconnect {false} |
◆ fPauseRecv
std::atomic_bool CNode::fPauseRecv {false} |
◆ fPauseSend
std::atomic_bool CNode::fPauseSend {false} |
◆ fSuccessfullyConnected
std::atomic_bool CNode::fSuccessfullyConnected {false} |
fSuccessfullyConnected is set to true on receiving VERACK from the peer.
Definition at line 449 of file net.h.
◆ grantOutbound
◆ id
◆ m_addr_name
const std::string CNode::m_addr_name |
◆ m_bip152_highbandwidth_from
std::atomic<bool> CNode::m_bip152_highbandwidth_from {false} |
◆ m_bip152_highbandwidth_to
std::atomic<bool> CNode::m_bip152_highbandwidth_to {false} |
◆ m_conn_type
◆ m_deserializer
◆ m_greatest_common_version
◆ m_inbound_onion
const bool CNode::m_inbound_onion |
Whether this peer is an inbound onion, i.e. connected via our Tor onion service.
Definition at line 434 of file net.h.
◆ m_last_ping_time
std::atomic<std::chrono::microseconds> CNode::m_last_ping_time {0us} |
Last measured round-trip time.
Used only for RPC/GUI stats/debugging.
Definition at line 574 of file net.h.
◆ m_limited_node
bool CNode::m_limited_node {false} |
◆ m_min_ping_time
std::atomic<std::chrono::microseconds> CNode::m_min_ping_time {std::chrono::microseconds::max()} |
◆ m_permissionFlags
◆ m_prefer_evict
bool CNode::m_prefer_evict {false} |
◆ m_serializer
◆ m_tx_relay
std::unique_ptr<TxRelay> CNode::m_tx_relay |
◆ nKeyedNetGroup
const uint64_t CNode::nKeyedNetGroup |
◆ nLastBlockTime
std::atomic<int64_t> CNode::nLastBlockTime {0} |
UNIX epoch time of the last block received from this peer that we had not yet seen (e.g.
not already received from another peer), that passed preliminary validity checks and was saved to disk, even if we don't connect the block or it eventually fails connection. Used as an inbound peer eviction criterium in CConnman::AttemptToEvictConnection.
Definition at line 565 of file net.h.
◆ nLastRecv
std::atomic<int64_t> CNode::nLastRecv {0} |
◆ nLastSend
std::atomic<int64_t> CNode::nLastSend {0} |
◆ nLastTXTime
std::atomic<int64_t> CNode::nLastTXTime {0} |
UNIX epoch time of the last transaction received from this peer that we had not yet seen (e.g.
not already received from another peer) and that was accepted into our mempool. Used as an inbound peer eviction criterium in CConnman::AttemptToEvictConnection.
Definition at line 571 of file net.h.
◆ nLocalHostNonce
const uint64_t CNode::nLocalHostNonce |
|
private |
◆ nLocalServices
Services offered to this peer.
This is supplied by the parent CConnman during peer connection (CConnman::ConnectNode()) from its attribute of the same name.
This is const because there is no protocol defined for renegotiating services initially offered to a peer. The set of local services we offer should not change after initialization.
An interesting example of this is NODE_NETWORK and initial block download: a node which starts up from scratch doesn't have any blocks to serve, but still advertises NODE_NETWORK because it will eventually fulfill this role after IBD completes. P2P code is written in such a way that it can gracefully handle peers who don't make good on their service advertisements.
Definition at line 690 of file net.h.
◆ nProcessQueueSize
size_t CNode::nProcessQueueSize {0} |
◆ nRefCount
std::atomic<int> CNode::nRefCount {0} |
◆ nServices
◆ nTimeConnected
const int64_t CNode::nTimeConnected |
Unix epoch time at peer connection, in seconds.
Definition at line 426 of file net.h.
◆ nTimeOffset
std::atomic<int64_t> CNode::nTimeOffset {0} |
◆ nVersion
std::atomic<int> CNode::nVersion {0} |
◆ vRecvMsg
The documentation for this class was generated from the following files: