mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
cmux: Remove round-robin circuit policy
Since 0.2.4, tor uses EWMA circuit policy to prioritize. The previous algorithm, round-robin, hasn't been used since then but was still used as a fallback. Now that EWMA is mandatory, remove that code entirely and enforce a cmux policy to be set. This is part of a circuitmux cleanup to improve performance and reduce complexity in the code. We'll be able to address future optimization with this work. Closes #25268 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
@@ -281,6 +281,7 @@ new_fake_channel(void)
|
||||
chan->state = CHANNEL_STATE_OPEN;
|
||||
|
||||
chan->cmux = circuitmux_alloc();
|
||||
circuitmux_set_policy(chan->cmux, &ewma_policy);
|
||||
|
||||
return chan;
|
||||
}
|
||||
@@ -582,8 +583,6 @@ test_channel_outbound_cell(void *arg)
|
||||
* to the channel's cmux as well. */
|
||||
circuit_set_n_circid_chan(TO_CIRCUIT(circ), 42, chan);
|
||||
tt_int_op(channel_num_circuits(chan), OP_EQ, 1);
|
||||
tt_assert(!TO_CIRCUIT(circ)->next_active_on_n_chan);
|
||||
tt_assert(!TO_CIRCUIT(circ)->prev_active_on_n_chan);
|
||||
/* Test the cmux state. */
|
||||
tt_ptr_op(TO_CIRCUIT(circ)->n_mux, OP_EQ, chan->cmux);
|
||||
tt_int_op(circuitmux_is_circuit_attached(chan->cmux, TO_CIRCUIT(circ)),
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "or.h"
|
||||
#include "channel.h"
|
||||
#include "circuitmux.h"
|
||||
#include "circuitmux_ewma.h"
|
||||
#include "relay.h"
|
||||
#include "scheduler.h"
|
||||
#include "test.h"
|
||||
@@ -45,6 +46,7 @@ test_cmux_destroy_cell_queue(void *arg)
|
||||
cmux = circuitmux_alloc();
|
||||
tt_assert(cmux);
|
||||
ch = new_fake_channel();
|
||||
circuitmux_set_policy(cmux, &ewma_policy);
|
||||
ch->has_queued_writes = has_queued_writes;
|
||||
ch->wide_circ_ids = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user