Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 848 Lines • ▼ Show 20 Lines | public: | ||||
std::atomic<int64_t> nLastRecv{0}; | std::atomic<int64_t> nLastRecv{0}; | ||||
const int64_t nTimeConnected; | const int64_t nTimeConnected; | ||||
std::atomic<int64_t> nTimeOffset{0}; | std::atomic<int64_t> nTimeOffset{0}; | ||||
// Address of this peer | // Address of this peer | ||||
const CAddress addr; | const CAddress addr; | ||||
// Bind address of our side of the connection | // Bind address of our side of the connection | ||||
const CAddress addrBind; | const CAddress addrBind; | ||||
std::atomic<int> nVersion{0}; | std::atomic<int> nVersion{0}; | ||||
RecursiveMutex cs_SubVer; | // The nonce provided by the remote host. | ||||
uint64_t nRemoteHostNonce{0}; | |||||
// The extra entropy provided by the remote host. | |||||
uint64_t nRemoteExtraEntropy{0}; | |||||
/** | /** | ||||
* cleanSubVer is a sanitized string of the user agent byte array we read | * 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. | * from the wire. This cleaned string can safely be logged or displayed. | ||||
*/ | */ | ||||
RecursiveMutex cs_SubVer; | |||||
std::string cleanSubVer GUARDED_BY(cs_SubVer){}; | std::string cleanSubVer GUARDED_BY(cs_SubVer){}; | ||||
// This peer is preferred for eviction. | // This peer is preferred for eviction. | ||||
bool m_prefer_evict{false}; | bool m_prefer_evict{false}; | ||||
bool HasPermission(NetPermissionFlags permission) const { | bool HasPermission(NetPermissionFlags permission) const { | ||||
return NetPermissions::HasFlag(m_permissionFlags, permission); | return NetPermissions::HasFlag(m_permissionFlags, permission); | ||||
} | } | ||||
// This boolean is unusued in actual processing, only present for backward | // This boolean is unusued in actual processing, only present for backward | ||||
// compatibility at RPC/QT level | // compatibility at RPC/QT level | ||||
▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | public: | ||||
std::atomic<int64_t> nMinPingUsecTime{std::numeric_limits<int64_t>::max()}; | std::atomic<int64_t> nMinPingUsecTime{std::numeric_limits<int64_t>::max()}; | ||||
// Whether a ping is requested. | // Whether a ping is requested. | ||||
std::atomic<bool> fPingQueued{false}; | std::atomic<bool> fPingQueued{false}; | ||||
std::set<TxId> orphan_work_set; | std::set<TxId> orphan_work_set; | ||||
CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, | CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, | ||||
SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, | SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, | ||||
uint64_t nLocalHostNonceIn, const CAddress &addrBindIn, | uint64_t nLocalHostNonceIn, uint64_t nLocalExtraEntropyIn, | ||||
const std::string &addrNameIn, ConnectionType conn_type_in); | const CAddress &addrBindIn, const std::string &addrNameIn, | ||||
ConnectionType conn_type_in); | |||||
~CNode(); | ~CNode(); | ||||
CNode(const CNode &) = delete; | CNode(const CNode &) = delete; | ||||
CNode &operator=(const CNode &) = delete; | CNode &operator=(const CNode &) = delete; | ||||
private: | private: | ||||
const NodeId id; | const NodeId id; | ||||
const uint64_t nLocalHostNonce; | const uint64_t nLocalHostNonce; | ||||
const uint64_t nLocalExtraEntropy; | |||||
const ConnectionType m_conn_type; | const ConnectionType m_conn_type; | ||||
//! Services offered to this peer. | //! Services offered to this peer. | ||||
//! | //! | ||||
//! This is supplied by the parent CConnman during peer connection | //! This is supplied by the parent CConnman during peer connection | ||||
//! (CConnman::ConnectNode()) from its attribute of the same name. | //! (CConnman::ConnectNode()) from its attribute of the same name. | ||||
//! | //! | ||||
//! This is const because there is no protocol defined for renegotiating | //! This is const because there is no protocol defined for renegotiating | ||||
Show All 20 Lines | private: | ||||
// Our address, as reported by the peer | // Our address, as reported by the peer | ||||
CService addrLocal GUARDED_BY(cs_addrLocal); | CService addrLocal GUARDED_BY(cs_addrLocal); | ||||
mutable RecursiveMutex cs_addrLocal; | mutable RecursiveMutex cs_addrLocal; | ||||
public: | public: | ||||
NodeId GetId() const { return id; } | NodeId GetId() const { return id; } | ||||
uint64_t GetLocalNonce() const { return nLocalHostNonce; } | uint64_t GetLocalNonce() const { return nLocalHostNonce; } | ||||
uint64_t GetLocalExtraEntropy() const { return nLocalExtraEntropy; } | |||||
int GetMyStartingHeight() const { return nMyStartingHeight; } | int GetMyStartingHeight() const { return nMyStartingHeight; } | ||||
int GetRefCount() const { | int GetRefCount() const { | ||||
assert(nRefCount >= 0); | assert(nRefCount >= 0); | ||||
return nRefCount; | return nRefCount; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |