diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-12-13 12:02:10 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-12-13 12:32:09 +0100 |
commit | fad7ead146a152f46b25ce6623e05cbb1dbc8cca (patch) | |
tree | 3eb7c696b2d23d76dda3b6b95e819efc9e826d80 /src/net.cpp | |
parent | eb63b8fab91c3aec46ef4ae66e6241ed5de49bbd (diff) |
refactor: Use type-safe std::chrono in net
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp index 2e2aa9dcef..094a3f7de6 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1023,12 +1023,12 @@ void ProtectEvictionCandidatesByRatio(std::vector<NodeEvictionCandidate>& evicti // (vEvictionCandidates is already sorted by reverse connect time) uint64_t naMostConnections; unsigned int nMostConnections = 0; - int64_t nMostConnectionsTime = 0; + std::chrono::seconds nMostConnectionsTime{0}; std::map<uint64_t, std::vector<NodeEvictionCandidate> > mapNetGroupNodes; for (const NodeEvictionCandidate &node : vEvictionCandidates) { std::vector<NodeEvictionCandidate> &group = mapNetGroupNodes[node.nKeyedNetGroup]; group.push_back(node); - const int64_t grouptime = group[0].nTimeConnected; + const auto grouptime{group[0].nTimeConnected}; if (group.size() > nMostConnections || (group.size() == nMostConnections && grouptime > nMostConnectionsTime)) { nMostConnections = group.size(); @@ -1320,7 +1320,7 @@ void CConnman::NotifyNumConnectionsChanged() bool CConnman::ShouldRunInactivityChecks(const CNode& node, std::chrono::seconds now) const { - return std::chrono::seconds{node.nTimeConnected} + m_peer_connect_timeout < now; + return node.nTimeConnected + m_peer_connect_timeout < now; } bool CConnman::InactivityCheck(const CNode& node) const |