]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Correctly handle machines out of tokens that have not closed yet.
authorGeorge Kadianakis <desnacked@riseup.net>
Wed, 17 Apr 2019 10:23:23 +0000 (13:23 +0300)
committerGeorge Kadianakis <desnacked@riseup.net>
Thu, 16 May 2019 11:07:32 +0000 (14:07 +0300)
Perhaps the machine on the other side is still not done.

src/core/or/circuitpadding.c

index c0caacf581e6cae923f09c5a89cefc4d84843a93..e02cfb7bce309dc616c9f0bbfd963e9137d46b2d 100644 (file)
@@ -605,6 +605,11 @@ circpad_machine_sample_delay(circpad_machine_runtime_t *mi)
     histogram_total_tokens = state->histogram_total_tokens;
   }
 
+  /* If we are out of tokens, don't schedule padding. */
+  if (!histogram_total_tokens) {
+    return CIRCPAD_DELAY_INFINITE;
+  }
+
   bin_choice = crypto_fast_rng_get_uint64(get_thread_fast_rng(),
                                           histogram_total_tokens);