commit 1c05dfd0b6ae9303d1f815a4d610655f32c0cc50 Merge: 647a90b af1469b Author: Nick Mathewson nickm@torproject.org Date: Sun Dec 21 14:48:53 2014 -0500
Merge branch 'ticket7356_squashed'
changes/bug7356 | 5 ++ src/or/channel.c | 119 +++++++++++++++++------------------------------- src/or/channel.h | 33 ++++++++++++++ src/or/channeltls.c | 14 +++--- src/or/circpathbias.c | 4 +- src/or/circuitbuild.c | 2 +- src/or/circuitlist.c | 8 +--- src/or/connection.c | 3 +- src/or/connection_or.c | 12 ++--- 9 files changed, 95 insertions(+), 105 deletions(-)
diff --cc src/or/channel.c index 5ee0748,5651bb4..4826bdd --- a/src/or/channel.c +++ b/src/or/channel.c @@@ -1772,12 -1664,9 +1743,12 @@@ channel_write_cell_queue_entry(channel_ } }
+ /* For statistical purposes, figure out how big this cell is */ + cell_bytes = channel_get_cell_queue_entry_size(chan, q); + /* Can we send it right out? If so, try */ if (TOR_SIMPLEQ_EMPTY(&chan->outgoing_queue) && - chan->state == CHANNEL_STATE_OPEN) { + CHANNEL_IS_OPEN(chan)) { /* Pick the right write function for this cell type and save the result */ switch (q->type) { case CELL_QUEUE_FIXED: @@@ -1826,16 -1708,8 +1797,16 @@@ */ tmp = cell_queue_entry_dup(q); TOR_SIMPLEQ_INSERT_TAIL(&chan->outgoing_queue, tmp, next); + /* Update global counters */ + ++n_channel_cells_queued; + ++n_channel_cells_in_queues; + n_channel_bytes_queued += cell_bytes; + n_channel_bytes_in_queues += cell_bytes; + channel_assert_counter_consistency(); + /* Update channel queue size */ + chan->bytes_in_queue += cell_bytes; /* Try to process the queue? */ - if (chan->state == CHANNEL_STATE_OPEN) channel_flush_cells(chan); + if (CHANNEL_IS_OPEN(chan)) channel_flush_cells(chan); } }
@@@ -2302,15 -2098,11 +2273,15 @@@ channel_flush_some_cells_from_outgoing_ if (!unlimited && num_cells <= flushed) return 0;
/* If we aren't in CHANNEL_STATE_OPEN, nothing goes through */ - if (chan->state == CHANNEL_STATE_OPEN) { + if (CHANNEL_IS_OPEN(chan)) { while ((unlimited || num_cells > flushed) && NULL != (q = TOR_SIMPLEQ_FIRST(&chan->outgoing_queue))) { + free_q = 0; + handed_off = 0;
if (1) { + /* Figure out how big it is for statistical purposes */ + cell_size = channel_get_cell_queue_entry_size(chan, q); /* * Okay, we have a good queue entry, try to give it to the lower * layer.
tor-commits@lists.torproject.org