aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/net.h b/src/net.h
index e9baa57a9b..3c03f7f9da 100644
--- a/src/net.h
+++ b/src/net.h
@@ -48,7 +48,7 @@ static const bool DEFAULT_WHITELISTRELAY = true;
static const bool DEFAULT_WHITELISTFORCERELAY = false;
/** Time after which to disconnect, after waiting for a ping response (or inactivity). */
-static const int TIMEOUT_INTERVAL = 20 * 60;
+static constexpr std::chrono::minutes TIMEOUT_INTERVAL{20};
/** Run the feeler connection loop once every 2 minutes. **/
static constexpr auto FEELER_INTERVAL = 2min;
/** Run the extra block-relay-only connection loop once every 5 minutes. **/
@@ -241,8 +241,8 @@ public:
NodeId nodeid;
ServiceFlags nServices;
bool fRelayTxes;
- int64_t nLastSend;
- int64_t nLastRecv;
+ std::chrono::seconds m_last_send;
+ std::chrono::seconds m_last_recv;
int64_t nLastTXTime;
int64_t nLastBlockTime;
int64_t nTimeConnected;
@@ -420,8 +420,8 @@ public:
uint64_t nRecvBytes GUARDED_BY(cs_vRecv){0};
- std::atomic<int64_t> nLastSend{0};
- std::atomic<int64_t> nLastRecv{0};
+ 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;
std::atomic<int64_t> nTimeOffset{0};
@@ -784,7 +784,7 @@ public:
m_msgproc = connOptions.m_msgproc;
nSendBufferMaxSize = connOptions.nSendBufferMaxSize;
nReceiveFloodSize = connOptions.nReceiveFloodSize;
- m_peer_connect_timeout = connOptions.m_peer_connect_timeout;
+ m_peer_connect_timeout = std::chrono::seconds{connOptions.m_peer_connect_timeout};
{
LOCK(cs_totalBytesSent);
nMaxOutboundLimit = connOptions.nMaxOutboundLimit;
@@ -942,7 +942,7 @@ public:
std::chrono::microseconds PoissonNextSendInbound(std::chrono::microseconds now, std::chrono::seconds average_interval);
/** Return true if we should disconnect the peer for failing an inactivity check. */
- bool ShouldRunInactivityChecks(const CNode& node, int64_t secs_now) const;
+ bool ShouldRunInactivityChecks(const CNode& node, std::chrono::seconds now) const;
private:
struct ListenSocket {
@@ -1084,7 +1084,7 @@ private:
uint64_t nMaxOutboundLimit GUARDED_BY(cs_totalBytesSent);
// P2P timeout in seconds
- int64_t m_peer_connect_timeout;
+ std::chrono::seconds m_peer_connect_timeout;
// Whitelisted ranges. Any node connecting from these is automatically
// whitelisted (as well as those connecting to whitelisted binds).