aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitmux.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-06-10 13:35:45 -0400
committerNick Mathewson <nickm@torproject.org>2014-06-14 11:00:44 -0400
commit8f3e3279c198dd13c11ffd739ddf08dbe8b07762 (patch)
treecb013d3fe1b324718adc9a8ec75fc920c83fca07 /src/or/circuitmux.c
parent173a1afc5819f1fcabfa34bab5714d61088cc29f (diff)
downloadtor-8f3e3279c198dd13c11ffd739ddf08dbe8b07762.tar.gz
tor-8f3e3279c198dd13c11ffd739ddf08dbe8b07762.zip
Try to diagnose bug 12184
Check for consistency between the queued destroy cells and the marked circuit IDs. Check for consistency in the count of queued destroy cells in several ways. Check to see whether any of the marked circuit IDs have somehow been marked longer than the channel has existed.
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 52ebfef084..563166eb46 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;
+}