aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitmux.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-06-14 11:01:04 -0400
committerNick Mathewson <nickm@torproject.org>2014-06-14 11:01:04 -0400
commita58d94fb7c6c304ecba930eaa7ebbade1d0686ab (patch)
tree7c36b6a4f13246cec4644ebebba223f774c7dcbf /src/or/circuitmux.c
parentcfca2a6037c139a82677a0ba2776d4ddf6ca6d04 (diff)
parent8f3e3279c198dd13c11ffd739ddf08dbe8b07762 (diff)
downloadtor-a58d94fb7c6c304ecba930eaa7ebbade1d0686ab.tar
tor-a58d94fb7c6c304ecba930eaa7ebbade1d0686ab.tar.gz
Merge branch 'bug12184_diagnostic_squashed'
Diffstat (limited to 'src/or/circuitmux.c')
-rw-r--r--src/or/circuitmux.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/or/circuitmux.c b/src/or/circuitmux.c
index 52ebfef08..563166eb4 100644
--- a/src/or/circuitmux.c
+++ b/src/or/circuitmux.c
@@ -1909,3 +1909,38 @@ circuitmux_append_destroy_cell(channel_t *chan,
}
}
+/*DOCDOC; for debugging 12184. This runs slowly. */
+int64_t
+circuitmux_count_queued_destroy_cells(const channel_t *chan,
+ const circuitmux_t *cmux)
+{
+ int64_t n_destroy_cells = cmux->destroy_ctr;
+ int64_t destroy_queue_size = cmux->destroy_cell_queue.n;
+
+ int64_t manual_total = 0;
+ int64_t manual_total_in_map = 0;
+ packed_cell_t *cell;
+
+ TOR_SIMPLEQ_FOREACH(cell, &cmux->destroy_cell_queue.head, next) {
+ circid_t id;
+ ++manual_total;
+
+ id = packed_cell_get_circid(cell, chan->wide_circ_ids);
+ if (circuit_id_in_use_on_channel(id, (channel_t*)chan))
+ ++manual_total_in_map;
+ }
+
+ if (n_destroy_cells != destroy_queue_size ||
+ n_destroy_cells != manual_total ||
+ n_destroy_cells != manual_total_in_map) {
+ log_warn(LD_BUG, " Discrepancy in counts for queued destroy cells on "
+ "circuitmux. n="I64_FORMAT". queue_size="I64_FORMAT". "
+ "manual_total="I64_FORMAT". manual_total_in_map="I64_FORMAT".",
+ I64_PRINTF_ARG(n_destroy_cells),
+ I64_PRINTF_ARG(destroy_queue_size),
+ I64_PRINTF_ARG(manual_total),
+ I64_PRINTF_ARG(manual_total_in_map));
+ }
+
+ return n_destroy_cells;
+}