mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Stop downloading consensuses when a consensus has been downloaded
Previosuly, during bootstrap, we would continue to download consensuses if we had a consensus, but didn't have the certificates to validate it.
This commit is contained in:
parent
53aaed81dd
commit
84ab26c320
@ -1247,16 +1247,30 @@ networkstatus_get_reasonably_live_consensus(time_t now, int flavor)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Check if we're bootstrapping a consensus download. This means that we are
|
||||
* only using the authorities and fallback directory mirrors to download the
|
||||
* consensus flavour we'll use. */
|
||||
/** Check if we need to download a consensus during tor's bootstrap phase.
|
||||
* If we have no consensus, or our consensus is unusably old, return 1.
|
||||
* As soon as we have received a consensus, return 0, even if we don't have
|
||||
* enough certificates to validate it. */
|
||||
int
|
||||
networkstatus_consensus_is_bootstrapping(time_t now)
|
||||
{
|
||||
/* If we don't have a consensus, we must still be bootstrapping */
|
||||
return !networkstatus_get_reasonably_live_consensus(
|
||||
now,
|
||||
usable_consensus_flavor());
|
||||
/* If we have a validated, reasonably live consensus, we're not
|
||||
* bootstrapping a consensus at all. */
|
||||
if (networkstatus_get_reasonably_live_consensus(
|
||||
now,
|
||||
usable_consensus_flavor())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If we have a consensus, but we're waiting for certificates,
|
||||
* we're not waiting for a consensus download while bootstrapping. */
|
||||
if (consensus_is_waiting_for_certs()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If we have no consensus, or our consensus is very old, we are
|
||||
* bootstrapping, and we need to download a consensus. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Check if we can use multiple directories for a consensus download.
|
||||
|
Loading…
Reference in New Issue
Block a user