aboutsummaryrefslogtreecommitdiff
path: root/src/feature/nodelist
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-02-14 17:39:34 +0200
committerGeorge Kadianakis <desnacked@riseup.net>2019-02-14 17:39:34 +0200
commit9bfe4ed6dd666bb276e35b6e5c8c3de0c218bce0 (patch)
tree3e7cb22f7289d2bb6c6af0ef3b75506c5af833af /src/feature/nodelist
parent6efc2a0e1f785e1e12fb8c7fd4b6aa4feceb647a (diff)
parent805f75182a87286a727df323be7c37add595bdff (diff)
downloadtor-9bfe4ed6dd666bb276e35b6e5c8c3de0c218bce0.tar.gz
tor-9bfe4ed6dd666bb276e35b6e5c8c3de0c218bce0.zip
Merge branch 'tor-github/pr/536' into maint-0.3.5
Diffstat (limited to 'src/feature/nodelist')
-rw-r--r--src/feature/nodelist/microdesc.c10
-rw-r--r--src/feature/nodelist/networkstatus.c7
-rw-r--r--src/feature/nodelist/networkstatus.h5
3 files changed, 11 insertions, 11 deletions
diff --git a/src/feature/nodelist/microdesc.c b/src/feature/nodelist/microdesc.c
index 3b4a7e1b30..dafaabb5e5 100644
--- a/src/feature/nodelist/microdesc.c
+++ b/src/feature/nodelist/microdesc.c
@@ -108,10 +108,12 @@ microdesc_note_outdated_dirserver(const char *relay_digest)
{
char relay_hexdigest[HEX_DIGEST_LEN+1];
- /* Don't register outdated dirservers if we don't have a live consensus,
- * since we might be trying to fetch microdescriptors that are not even
- * currently active. */
- if (!networkstatus_get_live_consensus(approx_time())) {
+ /* If we have a reasonably live consensus, then most of our dirservers should
+ * still be caching all the microdescriptors in it. Reasonably live
+ * consensuses are up to a day old. But microdescriptors expire 7 days after
+ * the last consensus that referenced them. */
+ if (!networkstatus_get_reasonably_live_consensus(approx_time(),
+ FLAV_MICRODESC)) {
return;
}
diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c
index d1155d85a0..c74acd8b74 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 f7d3ef92bb..9e7b0f1bb0 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);