aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_circuitmux.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-12-19 13:53:52 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-21 10:29:01 -0500
commit520cf21793e9c6b662c76c02235315f898d10fb9 (patch)
tree821564c2f105daa4d71980d866d825a2b64cd0c3 /src/test/test_circuitmux.c
parent1deda2106b0af16daaecc2e27982a28054e28345 (diff)
downloadtor-520cf21793e9c6b662c76c02235315f898d10fb9.tar.gz
tor-520cf21793e9c6b662c76c02235315f898d10fb9.zip
Move destroy cells into a separate queue type of their own, to save RAM
We've been seeing problems with destroy cells queues taking up a huge amount of RAM. We can mitigate this, since while a full packed destroy cell takes 514 bytes, we only need 5 bytes to remember a circuit ID and a reason. Fixes bug 24666. Bugfix on 0.2.5.1-alpha, when destroy cell queues were introduced.
Diffstat (limited to 'src/test/test_circuitmux.c')
-rw-r--r--src/test/test_circuitmux.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/test_circuitmux.c b/src/test/test_circuitmux.c
index b9c0436ebf..130be6fc99 100644
--- a/src/test/test_circuitmux.c
+++ b/src/test/test_circuitmux.c
@@ -33,8 +33,9 @@ test_cmux_destroy_cell_queue(void *arg)
circuitmux_t *cmux = NULL;
channel_t *ch = NULL;
circuit_t *circ = NULL;
- cell_queue_t *cq = NULL;
+ destroy_cell_queue_t *cq = NULL;
packed_cell_t *pc = NULL;
+ destroy_cell_t *dc = NULL;
#ifdef ENABLE_MEMPOOLS
init_cell_pool();
@@ -63,11 +64,10 @@ test_cmux_destroy_cell_queue(void *arg)
tt_int_op(cq->n, ==, 3);
- pc = cell_queue_pop(cq);
- tt_assert(pc);
- test_mem_op(pc->body, ==, "\x00\x00\x00\x64\x04\x0a\x00\x00\x00", 9);
- packed_cell_free(pc);
- pc = NULL;
+ dc = destroy_cell_queue_pop(cq);
+ tt_assert(dc);
+ tt_uint_op(dc->circid, ==, 100);
+ tor_free(dc);
tt_int_op(circuitmux_num_cells(cmux), ==, 2);