commit d71fa707dd01bdaa2ed301e82ace6fd23f63e638 Merge: a7779df84 ff2a98093 Author: George Kadianakis desnacked@riseup.net Date: Wed May 15 16:46:51 2019 +0300
Merge branch 'bug28780-squashed3-rebased' into bug28780_rebase
changes/ticket28780 | 3 + scripts/maint/practracker/exceptions.txt | 2 +- src/core/or/circuitlist.c | 11 ++ src/core/or/circuitlist.h | 28 ++--- src/core/or/circuitpadding.c | 119 ++++++++++++++++++- src/core/or/circuitpadding.h | 31 +++++ src/core/or/circuituse.c | 5 +- src/feature/client/circpathbias.c | 31 +++-- src/test/test_circuitpadding.c | 188 +++++++++++++++++++++++++++++++ 9 files changed, 388 insertions(+), 30 deletions(-)
diff --cc src/core/or/circuitpadding.c index cd58a191d,68140356c..ddf28ea62 --- a/src/core/or/circuitpadding.c +++ b/src/core/or/circuitpadding.c @@@ -1649,16 -1649,13 +1760,17 @@@ circpad_cell_event_nonpadding_sent(circ
/* If there are no machines then this loop should not iterate */ FOR_EACH_ACTIVE_CIRCUIT_MACHINE_BEGIN(i, on_circ) { - /* First, update any RTT estimate */ + /* First, update any timestamps */ + on_circ->padding_info[i]->last_cell_time_sec = approx_time(); circpad_estimate_circ_rtt_on_send(on_circ, on_circ->padding_info[i]);
- /* Remove a token: this is the idea of adaptive padding, since we have an - * ideal distribution that we want our distribution to look like. */ - if (!circpad_machine_remove_token(on_circ->padding_info[i])) { + /* Then, do accounting */ + circpad_machine_count_nonpadding_sent(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], @@@ -1699,16 -1697,9 +1812,17 @@@ voi circpad_cell_event_padding_sent(circuit_t *on_circ) { FOR_EACH_ACTIVE_CIRCUIT_MACHINE_BEGIN(i, on_circ) { - on_circ->padding_info[i]->last_cell_time_sec = approx_time(); - 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 */ + ++ on_circ->padding_info[i]->last_cell_time_sec = approx_time(); + circpad_machine_spec_transition(on_circ->padding_info[i], CIRCPAD_EVENT_PADDING_SENT); + } } FOR_EACH_ACTIVE_CIRCUIT_MACHINE_END; }
tor-commits@lists.torproject.org