mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
refactor: Use type-safe std::chrono in net
This commit is contained in:
20
src/net.h
20
src/net.h
@@ -243,9 +243,9 @@ public:
|
||||
bool fRelayTxes;
|
||||
std::chrono::seconds m_last_send;
|
||||
std::chrono::seconds m_last_recv;
|
||||
int64_t nLastTXTime;
|
||||
int64_t nLastBlockTime;
|
||||
int64_t nTimeConnected;
|
||||
std::chrono::seconds nLastTXTime;
|
||||
std::chrono::seconds nLastBlockTime;
|
||||
std::chrono::seconds nTimeConnected;
|
||||
int64_t nTimeOffset;
|
||||
std::string m_addr_name;
|
||||
int nVersion;
|
||||
@@ -422,8 +422,8 @@ public:
|
||||
|
||||
std::atomic<std::chrono::seconds> m_last_send{0s};
|
||||
std::atomic<std::chrono::seconds> m_last_recv{0s};
|
||||
//! Unix epoch time at peer connection, in seconds.
|
||||
const int64_t nTimeConnected;
|
||||
//! Unix epoch time at peer connection
|
||||
const std::chrono::seconds nTimeConnected;
|
||||
std::atomic<int64_t> nTimeOffset{0};
|
||||
// Address of this peer
|
||||
const CAddress addr;
|
||||
@@ -562,13 +562,13 @@ public:
|
||||
* 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. */
|
||||
std::atomic<int64_t> nLastBlockTime{0};
|
||||
std::atomic<std::chrono::seconds> nLastBlockTime{0s};
|
||||
|
||||
/** 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. */
|
||||
std::atomic<int64_t> nLastTXTime{0};
|
||||
std::atomic<std::chrono::seconds> nLastTXTime{0s};
|
||||
|
||||
/** Last measured round-trip time. Used only for RPC/GUI stats/debugging.*/
|
||||
std::atomic<std::chrono::microseconds> m_last_ping_time{0us};
|
||||
@@ -1274,10 +1274,10 @@ void CaptureMessage(const CAddress& addr, const std::string& msg_type, const Spa
|
||||
struct NodeEvictionCandidate
|
||||
{
|
||||
NodeId id;
|
||||
int64_t nTimeConnected;
|
||||
std::chrono::seconds nTimeConnected;
|
||||
std::chrono::microseconds m_min_ping_time;
|
||||
int64_t nLastBlockTime;
|
||||
int64_t nLastTXTime;
|
||||
std::chrono::seconds nLastBlockTime;
|
||||
std::chrono::seconds nLastTXTime;
|
||||
bool fRelevantServices;
|
||||
bool fRelayTxes;
|
||||
bool fBloomFilter;
|
||||
|
||||
Reference in New Issue
Block a user