diff options
author | Andrea Shepard <andrea@torproject.org> | 2016-06-12 19:07:11 +0000 |
---|---|---|
committer | Andrea Shepard <andrea@torproject.org> | 2016-06-18 16:32:16 +0000 |
commit | 695b0bd1d5aca52a05df1a697a6b23a20be529d4 (patch) | |
tree | 75c40277318788676f0c9363a2ce182b3d76e98c /src/or/or.h | |
parent | 033cf30b3cb505027c7542bb9b49717065a19fdf (diff) | |
download | tor-695b0bd1d5aca52a05df1a697a6b23a20be529d4.tar.gz tor-695b0bd1d5aca52a05df1a697a6b23a20be529d4.zip |
Implement DL_SCHED_RANDOM_EXPONENTIAL support for download_status_t
Diffstat (limited to 'src/or/or.h')
-rw-r--r-- | src/or/or.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h index 5a19f9a944..efe5680b40 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1987,6 +1987,15 @@ typedef enum { #define download_schedule_increment_bitfield_t \ ENUM_BF(download_schedule_increment_t) +/** Enumeration: do we want to use the random exponential backoff + * mechanism? */ +typedef enum { + DL_SCHED_DETERMINISTIC = 0, + DL_SCHED_RANDOM_EXPONENTIAL = 1, +} download_schedule_backoff_t; +#define download_schedule_backoff_bitfield_t \ + ENUM_BF(download_schedule_backoff_t) + /** Information about our plans for retrying downloads for a downloadable * directory object. * Each type of downloadable directory object has a corresponding retry @@ -2033,6 +2042,13 @@ typedef struct download_status_t { download_schedule_increment_bitfield_t increment_on : 1; /**< does this * schedule increment on each attempt, * or after each failure? */ + download_schedule_backoff_bitfield_t backoff : 1; /**< do we use the + * deterministic schedule, or random + * exponential backoffs? */ + uint8_t last_backoff_position; /**< number of attempts/failures, depending + * on increment_on, when we last recalculated + * the delay. */ + int last_delay_used; /**< last delay used for random exponential backoff */ } download_status_t; /** If n_download_failures is this high, the download can never happen. */ |