Merge remote-tracking branch 'teor/bug23470-029'

This commit is contained in:
Nick Mathewson 2017-09-13 09:20:19 -04:00
commit dcaf971a01
2 changed files with 17 additions and 11 deletions

6
changes/bug23470 Normal file
View File

@ -0,0 +1,6 @@
o Minor bugfix (relay address resolution):
- Avoid unnecessary calls to directory_fetches_from_authorities()
on relays. This avoids spurious address resolutions and
descriptor rebuilds. This is a mitigation for 21789. The original
bug was introduced in commit 35bbf2e as part of prop210.
Fixes 23470 in 0.2.8.1-alpha.

View File

@ -5323,26 +5323,24 @@ connection_dir_finished_connecting(dir_connection_t *conn)
STATIC const smartlist_t * STATIC const smartlist_t *
find_dl_schedule(const download_status_t *dls, const or_options_t *options) find_dl_schedule(const download_status_t *dls, const or_options_t *options)
{ {
const int dir_server = dir_server_mode(options);
const int multi_d = networkstatus_consensus_can_use_multiple_directories(
options);
const int we_are_bootstrapping = networkstatus_consensus_is_bootstrapping(
time(NULL));
const int use_fallbacks = networkstatus_consensus_can_use_extra_fallbacks(
options);
switch (dls->schedule) { switch (dls->schedule) {
case DL_SCHED_GENERIC: case DL_SCHED_GENERIC:
if (dir_server) { /* Any other directory document */
if (dir_server_mode(options)) {
/* A directory authority or directory mirror */
return options->TestingServerDownloadSchedule; return options->TestingServerDownloadSchedule;
} else { } else {
return options->TestingClientDownloadSchedule; return options->TestingClientDownloadSchedule;
} }
case DL_SCHED_CONSENSUS: case DL_SCHED_CONSENSUS:
if (!multi_d) { if (!networkstatus_consensus_can_use_multiple_directories(options)) {
/* A public relay */
return options->TestingServerConsensusDownloadSchedule; return options->TestingServerConsensusDownloadSchedule;
} else { } else {
if (we_are_bootstrapping) { /* A client or bridge */
if (!use_fallbacks) { if (networkstatus_consensus_is_bootstrapping(time(NULL))) {
/* During bootstrapping */
if (!networkstatus_consensus_can_use_extra_fallbacks(options)) {
/* A bootstrapping client without extra fallback directories */ /* A bootstrapping client without extra fallback directories */
return return
options->ClientBootstrapConsensusAuthorityOnlyDownloadSchedule; options->ClientBootstrapConsensusAuthorityOnlyDownloadSchedule;
@ -5358,6 +5356,8 @@ find_dl_schedule(const download_status_t *dls, const or_options_t *options)
options->ClientBootstrapConsensusFallbackDownloadSchedule; options->ClientBootstrapConsensusFallbackDownloadSchedule;
} }
} else { } else {
/* A client with a reasonably live consensus, with or without
* certificates */
return options->TestingClientConsensusDownloadSchedule; return options->TestingClientConsensusDownloadSchedule;
} }
} }