summaryrefslogtreecommitdiff
path: root/src/or/directory.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-06 20:08:11 -0500
committerNick Mathewson <nickm@torproject.org>2016-11-06 20:08:11 -0500
commit5385a023e105ffbb54f1c160298313c6a8cde57f (patch)
tree53768f6c1de8dc21143e1d8d72ec124a9b2b6cd1 /src/or/directory.h
parente9ce1819550f40132c30433914ff95b212957db0 (diff)
downloadtor-5385a023e105ffbb54f1c160298313c6a8cde57f.tar.gz
tor-5385a023e105ffbb54f1c160298313c6a8cde57f.zip
Do not apply 'max_failures' to random-exponential schedules.
Fixes bug 20536; bugfix on 0.2.9.1-alpha.
Diffstat (limited to 'src/or/directory.h')
-rw-r--r--src/or/directory.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/directory.h b/src/or/directory.h
index 9477948aa0..629b3ead90 100644
--- a/src/or/directory.h
+++ b/src/or/directory.h
@@ -114,9 +114,15 @@ static inline int
download_status_is_ready(download_status_t *dls, time_t now,
int max_failures)
{
- int under_failure_limit = (dls->n_download_failures <= max_failures
- && dls->n_download_attempts <= max_failures);
- return (under_failure_limit && dls->next_attempt_at <= now);
+ if (dls->backoff == DL_SCHED_DETERMINISTIC) {
+ /* Deterministic schedules can hit an endpoint; exponential backoff
+ * schedules just wait longer and longer. */
+ int under_failure_limit = (dls->n_download_failures <= max_failures
+ && dls->n_download_attempts <= max_failures);
+ if (!under_failure_limit)
+ return 0;
+ }
+ return dls->next_attempt_at <= now;
}
static void download_status_mark_impossible(download_status_t *dl);