]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
When using exponential backoff in test networks, use a lower exponent
authorteor <teor2345@gmail.com>
Tue, 8 Nov 2016 05:39:36 +0000 (16:39 +1100)
committerteor <teor2345@gmail.com>
Tue, 8 Nov 2016 05:42:26 +0000 (16:42 +1100)
Lower exponents mean that delays do not vary as much. This helps test
networks bootstrap consistently.

Bugfix on 20499.

changes/bug20597 [new file with mode: 0644]
src/or/directory.c

diff --git a/changes/bug20597 b/changes/bug20597
new file mode 100644 (file)
index 0000000..f199b63
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (test networks, exponential backoff):
+    - When using exponential backoff in test networks, use a lower exponent,
+      so the delays do not vary as much. This helps test networks bootstrap
+      consistently. Fixes bug 20597; bugfix on 20499; not in any released
+      version of tor.
index 1f399818c46492e658357d666038e6d62039f4da..f4fd521929cce3cc51e27e331e8394c14c0ef653 100644 (file)
@@ -3796,7 +3796,12 @@ next_random_exponential_delay(int delay, int max_delay)
 
   /* How much are we willing to add to the delay? */
   int max_increment;
-  const int multiplier = 3; /* no more than quadruple the previous delay */
+  int multiplier = 3; /* no more than quadruple the previous delay */
+  if (get_options()->TestingTorNetwork) {
+    /* Decrease the multiplier in testing networks. This reduces the variance,
+     * so that bootstrap is more reliable. */
+    multiplier = 2; /* no more than triple the previous delay */
+  }
 
   if (delay && delay < (INT_MAX-1) / multiplier) {
     max_increment = delay * multiplier;