summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2019-05-15 03:43:57 +0000
committerGeorge Kadianakis <desnacked@riseup.net>2019-05-15 15:10:48 +0300
commit5638d65f792393a85703342bfb14cc1a60550c18 (patch)
treec36a609b8549f466da1fed0ff0ae7521ac246806 /src
parent148c2d5bab051eb60e802fc6569c84a875c5f663 (diff)
downloadtor-5638d65f792393a85703342bfb14cc1a60550c18.tar.gz
tor-5638d65f792393a85703342bfb14cc1a60550c18.zip
Check the token supply when we received a padding event, too.
We need to check here because otherwise we can try to schedule padding with no tokens left upon the receipt of a padding event when our bins just became empty.
Diffstat (limited to 'src')
-rw-r--r--src/core/or/circuitpadding.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index 3124e74033..cd58a191d6 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -1699,8 +1699,16 @@ void
circpad_cell_event_padding_sent(circuit_t *on_circ)
{
FOR_EACH_ACTIVE_CIRCUIT_MACHINE_BEGIN(i, on_circ) {
- circpad_machine_spec_transition(on_circ->padding_info[i],
+ /* Check to see if we've run out of tokens for this state already,
+ * and if not, check for other state transitions */
+ if (check_machine_token_supply(on_circ->padding_info[i])
+ == CIRCPAD_STATE_UNCHANGED) {
+ /* If removing a token did not cause a transition, check if
+ * non-padding sent event should */
+
+ circpad_machine_spec_transition(on_circ->padding_info[i],
CIRCPAD_EVENT_PADDING_SENT);
+ }
} FOR_EACH_ACTIVE_CIRCUIT_MACHINE_END;
}