mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
Check queueing case in channel/flushmux unit test too
This commit is contained in:
parent
f12f7159a5
commit
9740a07b8c
@ -481,7 +481,7 @@ static void
|
||||
test_channel_flushmux(void *arg)
|
||||
{
|
||||
channel_t *ch = NULL;
|
||||
int old_count;
|
||||
int old_count, q_len_before, q_len_after;
|
||||
ssize_t result;
|
||||
|
||||
(void)arg;
|
||||
@ -512,6 +512,28 @@ test_channel_flushmux(void *arg)
|
||||
test_eq(test_cells_written, old_count + 1);
|
||||
test_eq(test_cmux_cells, 0);
|
||||
|
||||
/* Now try it without accepting to force them into the queue */
|
||||
test_chan_accept_cells = 0;
|
||||
test_cmux_cells = 1;
|
||||
q_len_before = chan_cell_queue_len(&(ch->outgoing_queue));
|
||||
|
||||
result = channel_flush_some_cells(ch, 1);
|
||||
|
||||
/* We should not have actually flushed any */
|
||||
test_eq(result, 0);
|
||||
test_eq(test_cells_written, old_count + 1);
|
||||
/* But we should have gotten to the fake cellgen loop */
|
||||
test_eq(test_cmux_cells, 0);
|
||||
/* ...and we should have a queued cell */
|
||||
q_len_after = chan_cell_queue_len(&(ch->outgoing_queue));
|
||||
test_eq(q_len_after, q_len_before + 1);
|
||||
|
||||
/* Now accept cells again and drain the queue */
|
||||
test_chan_accept_cells = 1;
|
||||
channel_flush_cells(ch);
|
||||
test_eq(test_cells_written, old_count + 2);
|
||||
test_eq(chan_cell_queue_len(&(ch->outgoing_queue)), 0);
|
||||
|
||||
test_target_cmux = NULL;
|
||||
test_cmux_cells = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user