aboutsummaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-07 09:32:21 -0500
committerNick Mathewson <nickm@torproject.org>2016-11-07 09:32:21 -0500
commit800dff13080111b1ce1c2f5e28d9ba326299f62a (patch)
tree5eb0f55bd231efd1f60c9d89b3c770e26148a48a /src/or/networkstatus.c
parenta415fee58abf7285e4d42652755b8f34da273f6d (diff)
parente4b793fe41fc09cc1f7753cfe90b74095a49a34f (diff)
downloadtor-800dff13080111b1ce1c2f5e28d9ba326299f62a.tar.gz
tor-800dff13080111b1ce1c2f5e28d9ba326299f62a.zip
Merge branch 'maint-0.2.9'
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index ed888fb53e..316ce48387 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -841,9 +841,15 @@ we_want_to_fetch_flavor(const or_options_t *options, int flavor)
* fetching certs before we check whether there is a better one? */
#define DELAY_WHILE_FETCHING_CERTS (20*60)
+/** What is the minimum time we need to have waited fetching certs, before we
+ * increment the consensus download schedule on failure? */
+#define MIN_DELAY_FOR_FETCH_CERT_STATUS_FAILURE (1*60)
+
/* Check if a downloaded consensus flavor should still wait for certificates
- * to download now.
- * If so, return 1. If not, fail dls and return 0. */
+ * to download now. If we decide not to wait, check if enough time has passed
+ * to consider the certificate download failure a separate failure. If so,
+ * fail dls.
+ * If waiting for certificates to download, return 1. If not, return 0. */
static int
check_consensus_waiting_for_certs(int flavor, time_t now,
download_status_t *dls)
@@ -857,11 +863,14 @@ check_consensus_waiting_for_certs(int flavor, time_t now,
waiting = &consensus_waiting_for_certs[flavor];
if (waiting->consensus) {
/* XXXX make sure this doesn't delay sane downloads. */
- if (waiting->set_at + DELAY_WHILE_FETCHING_CERTS > now) {
+ if (waiting->set_at + DELAY_WHILE_FETCHING_CERTS > now &&
+ waiting->consensus->valid_until > now) {
return 1;
} else {
if (!waiting->dl_failed) {
- download_status_failed(dls, 0);
+ if (waiting->set_at + MIN_DELAY_FOR_FETCH_CERT_STATUS_FAILURE > now) {
+ download_status_failed(dls, 0);
+ }
waiting->dl_failed=1;
}
}
@@ -906,7 +915,7 @@ update_consensus_networkstatus_downloads(time_t now)
resource = networkstatus_get_flavor_name(i);
/* Check if we already have enough connections in progress */
- if (we_are_bootstrapping) {
+ if (we_are_bootstrapping && use_multi_conn) {
max_in_progress_conns =
options->ClientBootstrapConsensusMaxInProgressTries;
}