diff options
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/directory.c | 11 | ||||
-rw-r--r-- | src/or/directory.h | 12 | ||||
-rw-r--r-- | src/or/networkstatus.c | 2 |
3 files changed, 17 insertions, 8 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 1f894d9fb3..5fc15724cc 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -3770,7 +3770,10 @@ find_dl_min_and_max_delay(download_status_t *dls, const or_options_t *options, const smartlist_t *schedule = find_dl_schedule(dls, options); tor_assert(schedule != NULL && smartlist_len(schedule) >= 2); *min = *((int *)(smartlist_get(schedule, 0))); - *max = *((int *)((smartlist_get(schedule, smartlist_len(schedule) - 1)))); + if (dls->backoff == DL_SCHED_DETERMINISTIC) + *max = *((int *)((smartlist_get(schedule, smartlist_len(schedule) - 1)))); + else + *max = INT_MAX; } /** Advance one delay step. The algorithm is to use the previous delay to @@ -3876,9 +3879,9 @@ download_status_schedule_get_delay(download_status_t *dls, * non-negative allows us to safely do the wrapping check below. */ tor_assert(delay >= 0); - /* Avoid now+delay overflowing INT_MAX, by comparing with a subtraction + /* Avoid now+delay overflowing TIME_MAX, by comparing with a subtraction * that won't overflow (since delay is non-negative). */ - if (delay < INT_MAX && now <= INT_MAX - delay) { + if (delay < INT_MAX && now <= TIME_MAX - delay) { dls->next_attempt_at = now+delay; } else { dls->next_attempt_at = TIME_MAX; @@ -3991,7 +3994,7 @@ download_status_increment_attempt(download_status_t *dls, const char *item, if (dls->increment_on == DL_SCHED_INCREMENT_FAILURE) { /* this schedule should retry on failure, and not launch any concurrent attempts */ - log_info(LD_BUG, "Tried to launch an attempt-based connection on a " + log_warn(LD_BUG, "Tried to launch an attempt-based connection on a " "failure-based schedule."); return TIME_MAX; } 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); diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 306857f018..2d39c90380 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -889,7 +889,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; } |