summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2018-11-21 15:55:43 +1000
committerteor <teor@torproject.org>2018-11-22 16:54:46 +1000
commitcebc39bcd56dde8f9824055fcd54707de56ab9b1 (patch)
treec7de2c4b649ba7420e2cd9cf8cf56d852267bf00 /src/feature
parent657618ba9bd96830b0a283c28db203bf9fffb15d (diff)
downloadtor-cebc39bcd56dde8f9824055fcd54707de56ab9b1.tar.gz
tor-cebc39bcd56dde8f9824055fcd54707de56ab9b1.zip
Test: make unit tests use a reasonably live consensus
Cleanup after 24661.
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/nodelist/networkstatus.c7
-rw-r--r--src/feature/nodelist/networkstatus.h5
2 files changed, 5 insertions, 7 deletions
diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c
index de2451b79c..51e720a984 100644
--- a/src/feature/nodelist/networkstatus.c
+++ b/src/feature/nodelist/networkstatus.c
@@ -1448,13 +1448,10 @@ networkstatus_valid_until_is_reasonably_live(time_t valid_until,
return (now <= valid_until + REASONABLY_LIVE_TIME);
}
-/* XXXX remove this in favor of get_live_consensus. But actually,
- * leave something like it for bridge users, who need to not totally
- * lose if they spend a while fetching a new consensus. */
/** As networkstatus_get_live_consensus(), but is way more tolerant of expired
* consensuses. */
-networkstatus_t *
-networkstatus_get_reasonably_live_consensus(time_t now, int flavor)
+MOCK_IMPL(networkstatus_t *,
+networkstatus_get_reasonably_live_consensus,(time_t now, int flavor))
{
networkstatus_t *consensus =
networkstatus_get_latest_consensus_by_flavor(flavor);
diff --git a/src/feature/nodelist/networkstatus.h b/src/feature/nodelist/networkstatus.h
index 6f8b2dc964..7b1a0ff72f 100644
--- a/src/feature/nodelist/networkstatus.h
+++ b/src/feature/nodelist/networkstatus.h
@@ -89,8 +89,9 @@ int networkstatus_consensus_reasonably_live(const networkstatus_t *consensus,
time_t now);
int networkstatus_valid_until_is_reasonably_live(time_t valid_until,
time_t now);
-networkstatus_t *networkstatus_get_reasonably_live_consensus(time_t now,
- int flavor);
+MOCK_DECL(networkstatus_t *,networkstatus_get_reasonably_live_consensus,
+ (time_t now,
+ int flavor));
MOCK_DECL(int, networkstatus_consensus_is_bootstrapping,(time_t now));
int networkstatus_consensus_can_use_multiple_directories(
const or_options_t *options);