[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Allow infinitely long delays in exponential-backoff downloads



commit 858867a31a31b7a0065481b1f5ad108f02ab337a
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Sun Nov 6 20:14:34 2016 -0500

    Allow infinitely long delays in exponential-backoff downloads
    
    It's only safe to remove the failure limit (per 20536) if we are in
    fact waiting a bit longer each time we try to download.
    
    Fixes bug 20534; bugfix on 0.2.9.1-alpha.
---
 changes/bug20534   | 6 ++++++
 src/or/directory.c | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/changes/bug20534 b/changes/bug20534
new file mode 100644
index 0000000..1ffa1f3
--- /dev/null
+++ b/changes/bug20534
@@ -0,0 +1,6 @@
+  o Minor bugfixes (directory download scheduling):
+    - Remove the maximum delay on exponential-backoff scheduling.
+      Since we now allow an infinite number of failures (see ticket
+      20536), we must now allow the time to grow longer on each failure.
+      Fixes bug 20534; bugfix on 0.2.9.1-alpha.
+
diff --git a/src/or/directory.c b/src/or/directory.c
index 24490b7..5fc1572 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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits