From 8f3e3279c198dd13c11ffd739ddf08dbe8b07762 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 10 Jun 2014 13:35:45 -0400 Subject: 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. --- src/or/relay.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/or/relay.c') diff --git a/src/or/relay.c b/src/or/relay.c index 509d7ced0..58d6db2b2 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -2563,6 +2563,17 @@ packed_cell_get_command(const packed_cell_t *cell, int wide_circ_ids) } } +/** Extract the circuit ID from a packed cell. */ +circid_t +packed_cell_get_circid(const packed_cell_t *cell, int wide_circ_ids) +{ + if (wide_circ_ids) { + return ntohl(get_uint32(cell->body)); + } else { + return ntohs(get_uint16(cell->body)); + } +} + /** Pull as many cells as possible (but no more than max) from the * queue of the first active circuit on chan, and write them to * chan->outbuf. Return the number of cells written. Advance -- cgit v1.2.3