From: Nick Mathewson Date: Sun, 21 Dec 2014 19:48:53 +0000 (-0500) Subject: Merge branch 'ticket7356_squashed' X-Git-Tag: tor-0.2.6.2-alpha~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1c05dfd0b6ae9303d1f815a4d610655f32c0cc50;p=thirdparty%2Ftor.git Merge branch 'ticket7356_squashed' --- 1c05dfd0b6ae9303d1f815a4d610655f32c0cc50 diff --cc src/or/channel.c index 5ee0748802,5651bb4b27..4826bdd0a7 --- 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.