aboutsummaryrefslogtreecommitdiff
path: root/src/bench/peer_eviction.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-12-15 13:07:07 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-12-15 13:07:34 +0100
commit60b5795133a2f6bed5d68340c5f5b6c225fa9cdb (patch)
treeb42b59a28c4fb49b0286163d3561498e96bf89eb /src/bench/peer_eviction.cpp
parent2d0bdb2089644f5904629413423cdc897911b081 (diff)
parentfad943821e35d0eb2143061e718f0193e12a4c71 (diff)
downloadbitcoin-60b5795133a2f6bed5d68340c5f5b6c225fa9cdb.tar.xz
Merge bitcoin/bitcoin#23758: net: Use type-safe mockable time for peer connection time
fad943821e35d0eb2143061e718f0193e12a4c71 scripted-diff: Rename touched member variables (MarcoFalke) fa663a4c0d20487ed3f7a93e1c2ca9932b05f5a8 Use mockable time for peer connection time (MarcoFalke) fad7ead146a152f46b25ce6623e05cbb1dbc8cca refactor: Use type-safe std::chrono in net (MarcoFalke) Pull request description: Benefits: * Type-safe * Mockable * Allows to revert a temporary test workaround ACKs for top commit: naumenkogs: ACK fad943821e35d0eb2143061e718f0193e12a4c71 shaavan: ACK fad943821e35d0eb2143061e718f0193e12a4c71 Tree-SHA512: af9bdfc695ab727b100c6810a7289d29b02b0ea9fa4fee9cc1f3eeefb52c8c465ea2734bae0c1c63b3b0d6264ba2c493268bc970ef6916570eb166de77829d82
Diffstat (limited to 'src/bench/peer_eviction.cpp')
-rw-r--r--src/bench/peer_eviction.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bench/peer_eviction.cpp b/src/bench/peer_eviction.cpp
index 8429f18613..f05f5e8f64 100644
--- a/src/bench/peer_eviction.cpp
+++ b/src/bench/peer_eviction.cpp
@@ -42,7 +42,7 @@ static void EvictionProtection0Networks250Candidates(benchmark::Bench& bench)
bench,
250 /* num_candidates */,
[](NodeEvictionCandidate& c) {
- c.nTimeConnected = c.id;
+ c.m_connected = std::chrono::seconds{c.id};
c.m_network = NET_IPV4;
});
}
@@ -53,7 +53,7 @@ static void EvictionProtection1Networks250Candidates(benchmark::Bench& bench)
bench,
250 /* num_candidates */,
[](NodeEvictionCandidate& c) {
- c.nTimeConnected = c.id;
+ c.m_connected = std::chrono::seconds{c.id};
c.m_is_local = false;
if (c.id >= 130 && c.id < 240) { // 110 Tor
c.m_network = NET_ONION;
@@ -69,7 +69,7 @@ static void EvictionProtection2Networks250Candidates(benchmark::Bench& bench)
bench,
250 /* num_candidates */,
[](NodeEvictionCandidate& c) {
- c.nTimeConnected = c.id;
+ c.m_connected = std::chrono::seconds{c.id};
c.m_is_local = false;
if (c.id >= 90 && c.id < 160) { // 70 Tor
c.m_network = NET_ONION;
@@ -87,7 +87,7 @@ static void EvictionProtection3Networks050Candidates(benchmark::Bench& bench)
bench,
50 /* num_candidates */,
[](NodeEvictionCandidate& c) {
- c.nTimeConnected = c.id;
+ c.m_connected = std::chrono::seconds{c.id};
c.m_is_local = (c.id == 28 || c.id == 47); // 2 localhost
if (c.id >= 30 && c.id < 47) { // 17 I2P
c.m_network = NET_I2P;
@@ -105,7 +105,7 @@ static void EvictionProtection3Networks100Candidates(benchmark::Bench& bench)
bench,
100 /* num_candidates */,
[](NodeEvictionCandidate& c) {
- c.nTimeConnected = c.id;
+ c.m_connected = std::chrono::seconds{c.id};
c.m_is_local = (c.id >= 55 && c.id < 60); // 5 localhost
if (c.id >= 70 && c.id < 80) { // 10 I2P
c.m_network = NET_I2P;
@@ -123,7 +123,7 @@ static void EvictionProtection3Networks250Candidates(benchmark::Bench& bench)
bench,
250 /* num_candidates */,
[](NodeEvictionCandidate& c) {
- c.nTimeConnected = c.id;
+ c.m_connected = std::chrono::seconds{c.id};
c.m_is_local = (c.id >= 140 && c.id < 160); // 20 localhost
if (c.id >= 170 && c.id < 180) { // 10 I2P
c.m_network = NET_I2P;