aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/circuitpadding.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-04-17 13:23:23 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2019-05-16 14:07:32 +0300
commit9b582edddb3a56d0eb2049820c6e14bfead7b143 (patch)
treecb7b53e8fbfcf285384475d24e762af05e3ce3c5 /src/core/or/circuitpadding.c
parent69a277f635d9f5d6e40d1f1e85110621b5c49169 (diff)
downloadtor-9b582edddb3a56d0eb2049820c6e14bfead7b143.tar.gz
tor-9b582edddb3a56d0eb2049820c6e14bfead7b143.zip
Correctly handle machines out of tokens that have not closed yet.
Perhaps the machine on the other side is still not done.
Diffstat (limited to 'src/core/or/circuitpadding.c')
-rw-r--r--src/core/or/circuitpadding.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index c0caacf581..e02cfb7bce 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -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);