mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Make authorities download consensuses if appropriate
An authority should never download a consensus if it has a live one, but when it doesn't, it should admit that it's not going to get one, and see if anybody else can give it one. Fixes 1300, fix on 0.2.0.9-alpha
This commit is contained in:
parent
2be5effe9a
commit
cc0efa8084
@ -1168,14 +1168,11 @@ update_v2_networkstatus_cache_downloads(time_t now)
|
|||||||
static void
|
static void
|
||||||
update_consensus_networkstatus_downloads(time_t now)
|
update_consensus_networkstatus_downloads(time_t now)
|
||||||
{
|
{
|
||||||
or_options_t *options = get_options();
|
|
||||||
int i;
|
int i;
|
||||||
if (!networkstatus_get_live_consensus(now))
|
if (!networkstatus_get_live_consensus(now))
|
||||||
time_to_download_next_consensus = now; /* No live consensus? Get one now!*/
|
time_to_download_next_consensus = now; /* No live consensus? Get one now!*/
|
||||||
if (time_to_download_next_consensus > now)
|
if (time_to_download_next_consensus > now)
|
||||||
return; /* Wait until the current consensus is older. */
|
return; /* Wait until the current consensus is older. */
|
||||||
if (authdir_mode_v3(options))
|
|
||||||
return; /* Authorities never fetch a consensus */
|
|
||||||
/* XXXXNM Microdescs: may need to download more types. */
|
/* XXXXNM Microdescs: may need to download more types. */
|
||||||
if (!download_status_is_ready(&consensus_dl_status[FLAV_NS], now,
|
if (!download_status_is_ready(&consensus_dl_status[FLAV_NS], now,
|
||||||
CONSENSUS_NETWORKSTATUS_MAX_DL_TRIES))
|
CONSENSUS_NETWORKSTATUS_MAX_DL_TRIES))
|
||||||
@ -1246,7 +1243,7 @@ update_consensus_networkstatus_fetch_time(time_t now)
|
|||||||
* is no longer fresh... */
|
* is no longer fresh... */
|
||||||
start = c->fresh_until + min_sec_before_caching;
|
start = c->fresh_until + min_sec_before_caching;
|
||||||
/* Some clients may need the consensus sooner than others. */
|
/* Some clients may need the consensus sooner than others. */
|
||||||
if (options->FetchDirInfoExtraEarly) {
|
if (options->FetchDirInfoExtraEarly || authdir_mode_v3(options)) {
|
||||||
dl_interval = 60;
|
dl_interval = 60;
|
||||||
if (min_sec_before_caching + dl_interval > interval)
|
if (min_sec_before_caching + dl_interval > interval)
|
||||||
dl_interval = interval/2;
|
dl_interval = interval/2;
|
||||||
|
Loading…
Reference in New Issue
Block a user