Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | struct CNodeStats { | ||||
bool fRelayTxes; | bool fRelayTxes; | ||||
std::chrono::seconds m_last_send; | std::chrono::seconds m_last_send; | ||||
std::chrono::seconds m_last_recv; | std::chrono::seconds m_last_recv; | ||||
std::chrono::seconds m_last_tx_time; | std::chrono::seconds m_last_tx_time; | ||||
std::chrono::seconds m_last_proof_time; | std::chrono::seconds m_last_proof_time; | ||||
std::chrono::seconds m_last_block_time; | std::chrono::seconds m_last_block_time; | ||||
std::chrono::seconds m_connected; | std::chrono::seconds m_connected; | ||||
int64_t nTimeOffset; | int64_t nTimeOffset; | ||||
std::string addrName; | std::string m_addr_name; | ||||
int nVersion; | int nVersion; | ||||
std::string cleanSubVer; | std::string cleanSubVer; | ||||
bool fInbound; | bool fInbound; | ||||
bool m_manual_connection; | bool m_manual_connection; | ||||
bool m_bip152_highbandwidth_to; | bool m_bip152_highbandwidth_to; | ||||
bool m_bip152_highbandwidth_from; | bool m_bip152_highbandwidth_from; | ||||
int m_starting_height; | int m_starting_height; | ||||
uint64_t nSendBytes; | uint64_t nSendBytes; | ||||
▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | public: | ||||
std::atomic<std::chrono::seconds> m_last_recv{0s}; | std::atomic<std::chrono::seconds> m_last_recv{0s}; | ||||
//! Unix epoch time at peer connection | //! Unix epoch time at peer connection | ||||
const std::chrono::seconds m_connected; | const std::chrono::seconds m_connected; | ||||
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; | ||||
const std::string m_addr_name; | |||||
//! Whether this peer is an inbound onion, i.e. connected via our Tor onion | //! Whether this peer is an inbound onion, i.e. connected via our Tor onion | ||||
//! service. | //! service. | ||||
const bool m_inbound_onion; | const bool m_inbound_onion; | ||||
std::atomic<int> nVersion{0}; | std::atomic<int> nVersion{0}; | ||||
// The nonce provided by the remote host. | // The nonce provided by the remote host. | ||||
uint64_t nRemoteHostNonce{0}; | uint64_t nRemoteHostNonce{0}; | ||||
// The extra entropy provided by the remote host. | // The extra entropy provided by the remote host. | ||||
uint64_t nRemoteExtraEntropy{0}; | uint64_t nRemoteExtraEntropy{0}; | ||||
▲ Show 20 Lines • Show All 268 Lines • ▼ Show 20 Lines | private: | ||||
//! way that it can gracefully handle peers who don't make good on their | //! way that it can gracefully handle peers who don't make good on their | ||||
//! service advertisements. | //! service advertisements. | ||||
const ServiceFlags nLocalServices; | const ServiceFlags nLocalServices; | ||||
NetPermissionFlags m_permissionFlags{PF_NONE}; | NetPermissionFlags m_permissionFlags{PF_NONE}; | ||||
// Used only by SocketHandler thread | // Used only by SocketHandler thread | ||||
std::list<CNetMessage> vRecvMsg; | std::list<CNetMessage> vRecvMsg; | ||||
mutable RecursiveMutex cs_addrName; | |||||
std::string addrName GUARDED_BY(cs_addrName); | |||||
// 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; | ||||
/** | /** | ||||
* The inventories polled and voted counters since last score | * The inventories polled and voted counters since last score | ||||
* computation, stored as a pair of uint32_t with the poll counter | * computation, stored as a pair of uint32_t with the poll counter | ||||
* being the 32 lowest bits and the vote counter the 32 highest bits. | * being the 32 lowest bits and the vote counter the 32 highest bits. | ||||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
void CloseSocketDisconnect(); | void CloseSocketDisconnect(); | ||||
void copyStats(CNodeStats &stats); | void copyStats(CNodeStats &stats); | ||||
ServiceFlags GetLocalServices() const { return nLocalServices; } | ServiceFlags GetLocalServices() const { return nLocalServices; } | ||||
std::string GetAddrName() const; | |||||
//! Sets the addrName only if it was not previously set | |||||
void MaybeSetAddrName(const std::string &addrNameIn); | |||||
std::string ConnectionTypeAsString() const; | std::string ConnectionTypeAsString() const; | ||||
}; | }; | ||||
/** | /** | ||||
* Interface for message handling | * Interface for message handling | ||||
*/ | */ | ||||
class NetEventsInterface { | class NetEventsInterface { | ||||
public: | public: | ||||
▲ Show 20 Lines • Show All 614 Lines • Show Last 20 Lines |