|
@@ -114,13 +114,6 @@ struct circuitmux_s {
|
|
*/
|
|
*/
|
|
chanid_circid_muxinfo_map_t *chanid_circid_map;
|
|
chanid_circid_muxinfo_map_t *chanid_circid_map;
|
|
|
|
|
|
-
|
|
|
|
- * Double-linked ring of circuits with queued cells waiting for room to
|
|
|
|
- * free up on this connection's outbuf. Every time we pull cells from
|
|
|
|
- * a circuit, we advance this pointer to the next circuit in the ring.
|
|
|
|
- */
|
|
|
|
- struct circuit_t *active_circuits_head, *active_circuits_tail;
|
|
|
|
-
|
|
|
|
|
|
|
|
destroy_cell_queue_t destroy_cell_queue;
|
|
destroy_cell_queue_t destroy_cell_queue;
|
|
|
|
|
|
@@ -176,17 +169,6 @@ struct chanid_circid_muxinfo_t {
|
|
circuit_muxinfo_t muxinfo;
|
|
circuit_muxinfo_t muxinfo;
|
|
};
|
|
};
|
|
|
|
|
|
-
|
|
|
|
- * Internal-use #defines
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-#ifdef CMUX_PARANOIA
|
|
|
|
-#define circuitmux_assert_okay_paranoid(cmux) \
|
|
|
|
- circuitmux_assert_okay(cmux)
|
|
|
|
-#else
|
|
|
|
-#define circuitmux_assert_okay_paranoid(cmux)
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
|
|
|
|
* Static function declarations
|
|
* Static function declarations
|
|
*/
|
|
*/
|
|
@@ -199,21 +181,9 @@ chanid_circid_entry_hash(chanid_circid_muxinfo_t *a);
|
|
static chanid_circid_muxinfo_t *
|
|
static chanid_circid_muxinfo_t *
|
|
circuitmux_find_map_entry(circuitmux_t *cmux, circuit_t *circ);
|
|
circuitmux_find_map_entry(circuitmux_t *cmux, circuit_t *circ);
|
|
static void
|
|
static void
|
|
-circuitmux_make_circuit_active(circuitmux_t *cmux, circuit_t *circ,
|
|
+circuitmux_make_circuit_active(circuitmux_t *cmux, circuit_t *circ);
|
|
- cell_direction_t direction);
|
|
|
|
static void
|
|
static void
|
|
-circuitmux_make_circuit_inactive(circuitmux_t *cmux, circuit_t *circ,
|
|
+circuitmux_make_circuit_inactive(circuitmux_t *cmux, circuit_t *circ);
|
|
- cell_direction_t direction);
|
|
|
|
-static inline void
|
|
|
|
-circuitmux_move_active_circ_to_tail(circuitmux_t *cmux, circuit_t *circ,
|
|
|
|
- cell_direction_t direction);
|
|
|
|
-static inline circuit_t **
|
|
|
|
-circuitmux_next_active_circ_p(circuitmux_t *cmux, circuit_t *circ);
|
|
|
|
-static inline circuit_t **
|
|
|
|
-circuitmux_prev_active_circ_p(circuitmux_t *cmux, circuit_t *circ);
|
|
|
|
-static void circuitmux_assert_okay_pass_one(circuitmux_t *cmux);
|
|
|
|
-static void circuitmux_assert_okay_pass_two(circuitmux_t *cmux);
|
|
|
|
-static void circuitmux_assert_okay_pass_three(circuitmux_t *cmux);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -222,119 +192,6 @@ static int64_t global_destroy_ctr = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
- * Linked list helpers
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Move an active circuit to the tail of the cmux's active circuits list;
|
|
|
|
- * used by circuitmux_notify_xmit_cells().
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-static inline void
|
|
|
|
-circuitmux_move_active_circ_to_tail(circuitmux_t *cmux, circuit_t *circ,
|
|
|
|
- cell_direction_t direction)
|
|
|
|
-{
|
|
|
|
- circuit_t **next_p = NULL, **prev_p = NULL;
|
|
|
|
- circuit_t **next_prev = NULL, **prev_next = NULL;
|
|
|
|
- circuit_t **tail_next = NULL;
|
|
|
|
- or_circuit_t *or_circ = NULL;
|
|
|
|
-
|
|
|
|
- tor_assert(cmux);
|
|
|
|
- tor_assert(circ);
|
|
|
|
-
|
|
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (direction) {
|
|
|
|
- if (direction == CELL_DIRECTION_OUT) {
|
|
|
|
- tor_assert(circ->n_mux == cmux);
|
|
|
|
- next_p = &(circ->next_active_on_n_chan);
|
|
|
|
- prev_p = &(circ->prev_active_on_n_chan);
|
|
|
|
- } else {
|
|
|
|
- or_circ = TO_OR_CIRCUIT(circ);
|
|
|
|
- tor_assert(or_circ->p_mux == cmux);
|
|
|
|
- next_p = &(or_circ->next_active_on_p_chan);
|
|
|
|
- prev_p = &(or_circ->prev_active_on_p_chan);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (circ->n_mux == cmux) {
|
|
|
|
- next_p = &(circ->next_active_on_n_chan);
|
|
|
|
- prev_p = &(circ->prev_active_on_n_chan);
|
|
|
|
- } else {
|
|
|
|
- or_circ = TO_OR_CIRCUIT(circ);
|
|
|
|
- tor_assert(or_circ->p_mux == cmux);
|
|
|
|
- next_p = &(or_circ->next_active_on_p_chan);
|
|
|
|
- prev_p = &(or_circ->prev_active_on_p_chan);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- tor_assert(next_p);
|
|
|
|
- tor_assert(prev_p);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if ((*next_p == NULL && *prev_p == NULL) &&
|
|
|
|
- !(circ == cmux->active_circuits_head ||
|
|
|
|
- circ == cmux->active_circuits_tail)) {
|
|
|
|
-
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (circ == cmux->active_circuits_tail) return;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (*next_p) next_prev = circuitmux_prev_active_circ_p(cmux, *next_p);
|
|
|
|
- if (*prev_p) prev_next = circuitmux_next_active_circ_p(cmux, *prev_p);
|
|
|
|
-
|
|
|
|
- if (prev_next) *prev_next = *next_p;
|
|
|
|
-
|
|
|
|
- else cmux->active_circuits_head = *next_p;
|
|
|
|
-
|
|
|
|
- if (next_prev) *next_prev = *prev_p;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- *next_p = NULL;
|
|
|
|
- *prev_p = cmux->active_circuits_tail;
|
|
|
|
-
|
|
|
|
- if (cmux->active_circuits_tail) {
|
|
|
|
- tail_next = circuitmux_next_active_circ_p(cmux,
|
|
|
|
- cmux->active_circuits_tail);
|
|
|
|
- *tail_next = circ;
|
|
|
|
- } else {
|
|
|
|
- cmux->active_circuits_head = circ;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- cmux->active_circuits_tail = circ;
|
|
|
|
-
|
|
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static inline circuit_t **
|
|
|
|
-circuitmux_next_active_circ_p(circuitmux_t *cmux, circuit_t *circ)
|
|
|
|
-{
|
|
|
|
- tor_assert(cmux);
|
|
|
|
- tor_assert(circ);
|
|
|
|
-
|
|
|
|
- if (circ->n_mux == cmux) return &(circ->next_active_on_n_chan);
|
|
|
|
- else {
|
|
|
|
- tor_assert(TO_OR_CIRCUIT(circ)->p_mux == cmux);
|
|
|
|
- return &(TO_OR_CIRCUIT(circ)->next_active_on_p_chan);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static inline circuit_t **
|
|
|
|
-circuitmux_prev_active_circ_p(circuitmux_t *cmux, circuit_t *circ)
|
|
|
|
-{
|
|
|
|
- tor_assert(cmux);
|
|
|
|
- tor_assert(circ);
|
|
|
|
-
|
|
|
|
- if (circ->n_mux == cmux) return &(circ->prev_active_on_n_chan);
|
|
|
|
- else {
|
|
|
|
- tor_assert(TO_OR_CIRCUIT(circ)->p_mux == cmux);
|
|
|
|
- return &(TO_OR_CIRCUIT(circ)->prev_active_on_p_chan);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
|
|
* Helper for chanid_circid_cell_count_map_t hash table: compare the channel
|
|
* Helper for chanid_circid_cell_count_map_t hash table: compare the channel
|
|
* ID and circuit ID for a and b, and return less than, equal to, or greater
|
|
* ID and circuit ID for a and b, and return less than, equal to, or greater
|
|
@@ -406,11 +263,6 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out)
|
|
circuit_t *circ = NULL;
|
|
circuit_t *circ = NULL;
|
|
|
|
|
|
tor_assert(cmux);
|
|
tor_assert(cmux);
|
|
-
|
|
|
|
- * Don't circuitmux_assert_okay_paranoid() here; this gets called when
|
|
|
|
- * channels are being freed and have already been unregistered, so
|
|
|
|
- * the channel ID lookups it does will fail.
|
|
|
|
- */
|
|
|
|
|
|
|
|
i = HT_START(chanid_circid_muxinfo_map, cmux->chanid_circid_map);
|
|
i = HT_START(chanid_circid_muxinfo_map, cmux->chanid_circid_map);
|
|
while (i) {
|
|
while (i) {
|
|
@@ -435,7 +287,7 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out)
|
|
*/
|
|
*/
|
|
|
|
|
|
if (to_remove->muxinfo.cell_count > 0) {
|
|
if (to_remove->muxinfo.cell_count > 0) {
|
|
- circuitmux_make_circuit_inactive(cmux, circ, CELL_DIRECTION_OUT);
|
|
+ circuitmux_make_circuit_inactive(cmux, circ);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -450,7 +302,7 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out)
|
|
*/
|
|
*/
|
|
|
|
|
|
if (to_remove->muxinfo.cell_count > 0) {
|
|
if (to_remove->muxinfo.cell_count > 0) {
|
|
- circuitmux_make_circuit_inactive(cmux, circ, CELL_DIRECTION_IN);
|
|
+ circuitmux_make_circuit_inactive(cmux, circ);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -606,9 +458,7 @@ circuitmux_clear_policy(circuitmux_t *cmux)
|
|
tor_assert(cmux);
|
|
tor_assert(cmux);
|
|
|
|
|
|
|
|
|
|
- if (cmux->policy) {
|
|
+ circuitmux_set_policy(cmux, NULL);
|
|
- circuitmux_set_policy(cmux, NULL);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -944,7 +794,6 @@ circuitmux_attach_circuit,(circuitmux_t *cmux, circuit_t *circ,
|
|
tor_assert(circ);
|
|
tor_assert(circ);
|
|
tor_assert(direction == CELL_DIRECTION_IN ||
|
|
tor_assert(direction == CELL_DIRECTION_IN ||
|
|
direction == CELL_DIRECTION_OUT);
|
|
direction == CELL_DIRECTION_OUT);
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
|
|
|
|
|
|
|
|
* Figure out which channel we're using, and get the circuit's current
|
|
* Figure out which channel we're using, and get the circuit's current
|
|
@@ -1002,10 +851,10 @@ circuitmux_attach_circuit,(circuitmux_t *cmux, circuit_t *circ,
|
|
*/
|
|
*/
|
|
if (hashent->muxinfo.cell_count > 0 && cell_count == 0) {
|
|
if (hashent->muxinfo.cell_count > 0 && cell_count == 0) {
|
|
--(cmux->n_active_circuits);
|
|
--(cmux->n_active_circuits);
|
|
- circuitmux_make_circuit_inactive(cmux, circ, direction);
|
|
+ circuitmux_make_circuit_inactive(cmux, circ);
|
|
} else if (hashent->muxinfo.cell_count == 0 && cell_count > 0) {
|
|
} else if (hashent->muxinfo.cell_count == 0 && cell_count > 0) {
|
|
++(cmux->n_active_circuits);
|
|
++(cmux->n_active_circuits);
|
|
- circuitmux_make_circuit_active(cmux, circ, direction);
|
|
+ circuitmux_make_circuit_active(cmux, circ);
|
|
}
|
|
}
|
|
cmux->n_cells -= hashent->muxinfo.cell_count;
|
|
cmux->n_cells -= hashent->muxinfo.cell_count;
|
|
cmux->n_cells += cell_count;
|
|
cmux->n_cells += cell_count;
|
|
@@ -1033,7 +882,7 @@ circuitmux_attach_circuit,(circuitmux_t *cmux, circuit_t *circ,
|
|
hashent->muxinfo.cell_count = cell_count;
|
|
hashent->muxinfo.cell_count = cell_count;
|
|
hashent->muxinfo.direction = direction;
|
|
hashent->muxinfo.direction = direction;
|
|
|
|
|
|
- if (cmux->policy && cmux->policy->alloc_circ_data) {
|
|
+ if (cmux->policy->alloc_circ_data) {
|
|
|
|
|
|
tor_assert(cmux->policy->free_circ_data);
|
|
tor_assert(cmux->policy->free_circ_data);
|
|
|
|
|
|
@@ -1053,25 +902,14 @@ circuitmux_attach_circuit,(circuitmux_t *cmux, circuit_t *circ,
|
|
if (direction == CELL_DIRECTION_OUT) circ->n_mux = cmux;
|
|
if (direction == CELL_DIRECTION_OUT) circ->n_mux = cmux;
|
|
else TO_OR_CIRCUIT(circ)->p_mux = cmux;
|
|
else TO_OR_CIRCUIT(circ)->p_mux = cmux;
|
|
|
|
|
|
-
|
|
|
|
- if (direction == CELL_DIRECTION_OUT) {
|
|
|
|
- circ->next_active_on_n_chan = NULL;
|
|
|
|
- circ->prev_active_on_n_chan = NULL;
|
|
|
|
- } else {
|
|
|
|
- TO_OR_CIRCUIT(circ)->next_active_on_p_chan = NULL;
|
|
|
|
- TO_OR_CIRCUIT(circ)->prev_active_on_p_chan = NULL;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
++(cmux->n_circuits);
|
|
++(cmux->n_circuits);
|
|
if (cell_count > 0) {
|
|
if (cell_count > 0) {
|
|
++(cmux->n_active_circuits);
|
|
++(cmux->n_active_circuits);
|
|
- circuitmux_make_circuit_active(cmux, circ, direction);
|
|
+ circuitmux_make_circuit_active(cmux, circ);
|
|
}
|
|
}
|
|
cmux->n_cells += cell_count;
|
|
cmux->n_cells += cell_count;
|
|
}
|
|
}
|
|
-
|
|
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1095,7 +933,6 @@ circuitmux_detach_circuit,(circuitmux_t *cmux, circuit_t *circ))
|
|
tor_assert(cmux);
|
|
tor_assert(cmux);
|
|
tor_assert(cmux->chanid_circid_map);
|
|
tor_assert(cmux->chanid_circid_map);
|
|
tor_assert(circ);
|
|
tor_assert(circ);
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
|
|
|
|
|
|
|
|
if (circ->n_chan) {
|
|
if (circ->n_chan) {
|
|
@@ -1133,7 +970,7 @@ circuitmux_detach_circuit,(circuitmux_t *cmux, circuit_t *circ))
|
|
if (hashent->muxinfo.cell_count > 0) {
|
|
if (hashent->muxinfo.cell_count > 0) {
|
|
--(cmux->n_active_circuits);
|
|
--(cmux->n_active_circuits);
|
|
|
|
|
|
- circuitmux_make_circuit_inactive(cmux, circ, last_searched_direction);
|
|
+ circuitmux_make_circuit_inactive(cmux, circ);
|
|
}
|
|
}
|
|
cmux->n_cells -= hashent->muxinfo.cell_count;
|
|
cmux->n_cells -= hashent->muxinfo.cell_count;
|
|
|
|
|
|
@@ -1162,8 +999,6 @@ circuitmux_detach_circuit,(circuitmux_t *cmux, circuit_t *circ))
|
|
|
|
|
|
tor_free(hashent);
|
|
tor_free(hashent);
|
|
}
|
|
}
|
|
-
|
|
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1172,94 +1007,22 @@ circuitmux_detach_circuit,(circuitmux_t *cmux, circuit_t *circ))
|
|
*/
|
|
*/
|
|
|
|
|
|
static void
|
|
static void
|
|
-circuitmux_make_circuit_active(circuitmux_t *cmux, circuit_t *circ,
|
|
+circuitmux_make_circuit_active(circuitmux_t *cmux, circuit_t *circ)
|
|
- cell_direction_t direction)
|
|
|
|
{
|
|
{
|
|
- circuit_t **next_active = NULL, **prev_active = NULL, **next_prev = NULL;
|
|
|
|
- circuitmux_t *circuit_cmux = NULL;
|
|
|
|
- chanid_circid_muxinfo_t *hashent = NULL;
|
|
|
|
- channel_t *chan = NULL;
|
|
|
|
- circid_t circ_id;
|
|
|
|
- int already_active;
|
|
|
|
-
|
|
|
|
tor_assert(cmux);
|
|
tor_assert(cmux);
|
|
|
|
+ tor_assert(cmux->policy);
|
|
tor_assert(circ);
|
|
tor_assert(circ);
|
|
- tor_assert(direction == CELL_DIRECTION_OUT ||
|
|
|
|
- direction == CELL_DIRECTION_IN);
|
|
|
|
-
|
|
|
|
- * Don't circuitmux_assert_okay_paranoid(cmux) here because the cell count
|
|
|
|
- * already got changed and we have to update the list for it to be consistent
|
|
|
|
- * again.
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (direction == CELL_DIRECTION_OUT) {
|
|
|
|
- next_active = &(circ->next_active_on_n_chan);
|
|
|
|
- prev_active = &(circ->prev_active_on_n_chan);
|
|
|
|
- circuit_cmux = circ->n_mux;
|
|
|
|
- chan = circ->n_chan;
|
|
|
|
- circ_id = circ->n_circ_id;
|
|
|
|
- } else {
|
|
|
|
- next_active = &(TO_OR_CIRCUIT(circ)->next_active_on_p_chan);
|
|
|
|
- prev_active = &(TO_OR_CIRCUIT(circ)->prev_active_on_p_chan);
|
|
|
|
- circuit_cmux = TO_OR_CIRCUIT(circ)->p_mux;
|
|
|
|
- chan = TO_OR_CIRCUIT(circ)->p_chan;
|
|
|
|
- circ_id = TO_OR_CIRCUIT(circ)->p_circ_id;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert(cmux == circuit_cmux);
|
|
|
|
- tor_assert(chan != NULL);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Check if the circuit really was inactive; if it's active, at least one
|
|
|
|
- * of the next_active and prev_active pointers will not be NULL, or this
|
|
|
|
- * circuit will be either the head or tail of the list for this cmux.
|
|
|
|
- */
|
|
|
|
- already_active = (*prev_active != NULL || *next_active != NULL ||
|
|
|
|
- cmux->active_circuits_head == circ ||
|
|
|
|
- cmux->active_circuits_tail == circ);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (already_active) {
|
|
|
|
- log_warn(LD_CIRC,
|
|
|
|
- "Circuit %u on channel " U64_FORMAT " was already active",
|
|
|
|
- (unsigned)circ_id, U64_PRINTF_ARG(chan->global_identifier));
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * This is going at the head of the list; if the old head is not NULL,
|
|
|
|
- * then its prev pointer should point to this.
|
|
|
|
- */
|
|
|
|
- *next_active = cmux->active_circuits_head;
|
|
|
|
- *prev_active = NULL;
|
|
|
|
- if (cmux->active_circuits_head) {
|
|
|
|
-
|
|
|
|
- next_prev =
|
|
|
|
- circuitmux_prev_active_circ_p(cmux, cmux->active_circuits_head);
|
|
|
|
- tor_assert(next_prev);
|
|
|
|
- *next_prev = circ;
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- cmux->active_circuits_tail = circ;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- cmux->active_circuits_head = circ;
|
|
|
|
|
|
|
|
|
|
|
|
- if (cmux->policy &&
|
|
+ if (cmux->policy->notify_circ_active) {
|
|
- cmux->policy->notify_circ_active) {
|
|
|
|
|
|
|
|
- hashent = circuitmux_find_map_entry(cmux, circ);
|
|
+ chanid_circid_muxinfo_t *hashent = circuitmux_find_map_entry(cmux, circ);
|
|
|
|
|
|
tor_assert(hashent);
|
|
tor_assert(hashent);
|
|
|
|
|
|
cmux->policy->notify_circ_active(cmux, cmux->policy_data,
|
|
cmux->policy->notify_circ_active(cmux, cmux->policy_data,
|
|
circ, hashent->muxinfo.policy_data);
|
|
circ, hashent->muxinfo.policy_data);
|
|
}
|
|
}
|
|
-
|
|
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1268,112 +1031,22 @@ circuitmux_make_circuit_active(circuitmux_t *cmux, circuit_t *circ,
|
|
*/
|
|
*/
|
|
|
|
|
|
static void
|
|
static void
|
|
-circuitmux_make_circuit_inactive(circuitmux_t *cmux, circuit_t *circ,
|
|
+circuitmux_make_circuit_inactive(circuitmux_t *cmux, circuit_t *circ)
|
|
- cell_direction_t direction)
|
|
|
|
{
|
|
{
|
|
- circuit_t **next_active = NULL, **prev_active = NULL;
|
|
|
|
- circuit_t **next_prev = NULL, **prev_next = NULL;
|
|
|
|
- circuitmux_t *circuit_cmux = NULL;
|
|
|
|
- chanid_circid_muxinfo_t *hashent = NULL;
|
|
|
|
- channel_t *chan = NULL;
|
|
|
|
- circid_t circ_id;
|
|
|
|
- int already_inactive;
|
|
|
|
-
|
|
|
|
tor_assert(cmux);
|
|
tor_assert(cmux);
|
|
|
|
+ tor_assert(cmux->policy);
|
|
tor_assert(circ);
|
|
tor_assert(circ);
|
|
- tor_assert(direction == CELL_DIRECTION_OUT ||
|
|
|
|
- direction == CELL_DIRECTION_IN);
|
|
|
|
-
|
|
|
|
- * Don't circuitmux_assert_okay_paranoid(cmux) here because the cell count
|
|
|
|
- * already got changed and we have to update the list for it to be consistent
|
|
|
|
- * again.
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (direction == CELL_DIRECTION_OUT) {
|
|
|
|
- next_active = &(circ->next_active_on_n_chan);
|
|
|
|
- prev_active = &(circ->prev_active_on_n_chan);
|
|
|
|
- circuit_cmux = circ->n_mux;
|
|
|
|
- chan = circ->n_chan;
|
|
|
|
- circ_id = circ->n_circ_id;
|
|
|
|
- } else {
|
|
|
|
- next_active = &(TO_OR_CIRCUIT(circ)->next_active_on_p_chan);
|
|
|
|
- prev_active = &(TO_OR_CIRCUIT(circ)->prev_active_on_p_chan);
|
|
|
|
- circuit_cmux = TO_OR_CIRCUIT(circ)->p_mux;
|
|
|
|
- chan = TO_OR_CIRCUIT(circ)->p_chan;
|
|
|
|
- circ_id = TO_OR_CIRCUIT(circ)->p_circ_id;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert(cmux == circuit_cmux);
|
|
|
|
- tor_assert(chan != NULL);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Check if the circuit really was active; if it's inactive, the
|
|
|
|
- * next_active and prev_active pointers will be NULL and this circuit
|
|
|
|
- * will not be the head or tail of the list for this cmux.
|
|
|
|
- */
|
|
|
|
- already_inactive = (*prev_active == NULL && *next_active == NULL &&
|
|
|
|
- cmux->active_circuits_head != circ &&
|
|
|
|
- cmux->active_circuits_tail != circ);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (already_inactive) {
|
|
|
|
- log_warn(LD_CIRC,
|
|
|
|
- "Circuit %d on channel " U64_FORMAT " was already inactive",
|
|
|
|
- (unsigned)circ_id, U64_PRINTF_ARG(chan->global_identifier));
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (*next_active) {
|
|
|
|
-
|
|
|
|
- * If there's a next circuit, its previous circuit becomes this
|
|
|
|
- * circuit's previous circuit.
|
|
|
|
- */
|
|
|
|
- next_prev = circuitmux_prev_active_circ_p(cmux, *next_active);
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- next_prev = &(cmux->active_circuits_tail);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (*prev_active) {
|
|
|
|
-
|
|
|
|
- * If there's a previous circuit, its next circuit becomes this circuit's
|
|
|
|
- * next circuit.
|
|
|
|
- */
|
|
|
|
- prev_next = circuitmux_next_active_circ_p(cmux, *prev_active);
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- prev_next = &(cmux->active_circuits_head);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert(next_prev != NULL);
|
|
|
|
- tor_assert(prev_next != NULL);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- *next_prev = *prev_active;
|
|
|
|
- *prev_next = *next_active;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- *prev_active = NULL;
|
|
|
|
- *next_active = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
- if (cmux->policy &&
|
|
+ if (cmux->policy->notify_circ_inactive) {
|
|
- cmux->policy->notify_circ_inactive) {
|
|
|
|
|
|
|
|
- hashent = circuitmux_find_map_entry(cmux, circ);
|
|
+ chanid_circid_muxinfo_t *hashent = circuitmux_find_map_entry(cmux, circ);
|
|
|
|
|
|
tor_assert(hashent);
|
|
tor_assert(hashent);
|
|
|
|
|
|
cmux->policy->notify_circ_inactive(cmux, cmux->policy_data,
|
|
cmux->policy->notify_circ_inactive(cmux, cmux->policy_data,
|
|
circ, hashent->muxinfo.policy_data);
|
|
circ, hashent->muxinfo.policy_data);
|
|
}
|
|
}
|
|
-
|
|
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1400,8 +1073,6 @@ circuitmux_set_num_cells(circuitmux_t *cmux, circuit_t *circ,
|
|
tor_assert(cmux);
|
|
tor_assert(cmux);
|
|
tor_assert(circ);
|
|
tor_assert(circ);
|
|
|
|
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
-
|
|
|
|
|
|
|
|
hashent = circuitmux_find_map_entry(cmux, circ);
|
|
hashent = circuitmux_find_map_entry(cmux, circ);
|
|
|
|
|
|
@@ -1412,7 +1083,7 @@ circuitmux_set_num_cells(circuitmux_t *cmux, circuit_t *circ,
|
|
cmux->n_cells += n_cells;
|
|
cmux->n_cells += n_cells;
|
|
|
|
|
|
|
|
|
|
- if (cmux->policy && cmux->policy->notify_set_n_cells) {
|
|
+ if (cmux->policy->notify_set_n_cells) {
|
|
|
|
|
|
cmux->policy->notify_set_n_cells(cmux,
|
|
cmux->policy->notify_set_n_cells(cmux,
|
|
cmux->policy_data,
|
|
cmux->policy_data,
|
|
@@ -1428,21 +1099,15 @@ circuitmux_set_num_cells(circuitmux_t *cmux, circuit_t *circ,
|
|
if (hashent->muxinfo.cell_count > 0 && n_cells == 0) {
|
|
if (hashent->muxinfo.cell_count > 0 && n_cells == 0) {
|
|
--(cmux->n_active_circuits);
|
|
--(cmux->n_active_circuits);
|
|
hashent->muxinfo.cell_count = n_cells;
|
|
hashent->muxinfo.cell_count = n_cells;
|
|
- circuitmux_make_circuit_inactive(cmux, circ, hashent->muxinfo.direction);
|
|
+ circuitmux_make_circuit_inactive(cmux, circ);
|
|
|
|
|
|
} else if (hashent->muxinfo.cell_count == 0 && n_cells > 0) {
|
|
} else if (hashent->muxinfo.cell_count == 0 && n_cells > 0) {
|
|
++(cmux->n_active_circuits);
|
|
++(cmux->n_active_circuits);
|
|
hashent->muxinfo.cell_count = n_cells;
|
|
hashent->muxinfo.cell_count = n_cells;
|
|
- circuitmux_make_circuit_active(cmux, circ, hashent->muxinfo.direction);
|
|
+ circuitmux_make_circuit_active(cmux, circ);
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
- * Update the entry cell count like this so we can put a
|
|
|
|
- * circuitmux_assert_okay_paranoid inside make_circuit_(in)active() too.
|
|
|
|
- */
|
|
|
|
hashent->muxinfo.cell_count = n_cells;
|
|
hashent->muxinfo.cell_count = n_cells;
|
|
}
|
|
}
|
|
-
|
|
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1468,6 +1133,9 @@ circuitmux_get_first_active_circuit(circuitmux_t *cmux,
|
|
circuit_t *circ = NULL;
|
|
circuit_t *circ = NULL;
|
|
|
|
|
|
tor_assert(cmux);
|
|
tor_assert(cmux);
|
|
|
|
+ tor_assert(cmux->policy);
|
|
|
|
+
|
|
|
|
+ tor_assert(cmux->policy->pick_active_circuit);
|
|
tor_assert(destroy_queue_out);
|
|
tor_assert(destroy_queue_out);
|
|
|
|
|
|
*destroy_queue_out = NULL;
|
|
*destroy_queue_out = NULL;
|
|
@@ -1486,14 +1154,7 @@ circuitmux_get_first_active_circuit(circuitmux_t *cmux,
|
|
|
|
|
|
tor_assert(cmux->n_cells > 0);
|
|
tor_assert(cmux->n_cells > 0);
|
|
|
|
|
|
- if (cmux->policy && cmux->policy->pick_active_circuit) {
|
|
+ circ = cmux->policy->pick_active_circuit(cmux, cmux->policy_data);
|
|
- circ = cmux->policy->pick_active_circuit(cmux, cmux->policy_data);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!circ) {
|
|
|
|
- tor_assert(cmux->active_circuits_head);
|
|
|
|
- circ = cmux->active_circuits_head;
|
|
|
|
- }
|
|
|
|
cmux->last_cell_was_destroy = 0;
|
|
cmux->last_cell_was_destroy = 0;
|
|
} else {
|
|
} else {
|
|
tor_assert(cmux->n_cells == 0);
|
|
tor_assert(cmux->n_cells == 0);
|
|
@@ -1517,7 +1178,6 @@ circuitmux_notify_xmit_cells(circuitmux_t *cmux, circuit_t *circ,
|
|
|
|
|
|
tor_assert(cmux);
|
|
tor_assert(cmux);
|
|
tor_assert(circ);
|
|
tor_assert(circ);
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
|
|
|
|
if (n_cells == 0) return;
|
|
if (n_cells == 0) return;
|
|
|
|
|
|
@@ -1544,17 +1204,11 @@ circuitmux_notify_xmit_cells(circuitmux_t *cmux, circuit_t *circ,
|
|
|
|
|
|
cmux->n_cells -= n_cells;
|
|
cmux->n_cells -= n_cells;
|
|
|
|
|
|
-
|
|
|
|
- if (!becomes_inactive) {
|
|
|
|
- circuitmux_move_active_circ_to_tail(cmux, circ,
|
|
|
|
- hashent->muxinfo.direction);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
* We call notify_xmit_cells() before making the circuit inactive if needed,
|
|
* We call notify_xmit_cells() before making the circuit inactive if needed,
|
|
* so the policy can always count on this coming in on an active circuit.
|
|
* so the policy can always count on this coming in on an active circuit.
|
|
*/
|
|
*/
|
|
- if (cmux->policy && cmux->policy->notify_xmit_cells) {
|
|
+ if (cmux->policy->notify_xmit_cells) {
|
|
cmux->policy->notify_xmit_cells(cmux, cmux->policy_data, circ,
|
|
cmux->policy->notify_xmit_cells(cmux, cmux->policy_data, circ,
|
|
hashent->muxinfo.policy_data,
|
|
hashent->muxinfo.policy_data,
|
|
n_cells);
|
|
n_cells);
|
|
@@ -1566,10 +1220,8 @@ circuitmux_notify_xmit_cells(circuitmux_t *cmux, circuit_t *circ,
|
|
*/
|
|
*/
|
|
if (becomes_inactive) {
|
|
if (becomes_inactive) {
|
|
--(cmux->n_active_circuits);
|
|
--(cmux->n_active_circuits);
|
|
- circuitmux_make_circuit_inactive(cmux, circ, hashent->muxinfo.direction);
|
|
+ circuitmux_make_circuit_inactive(cmux, circ);
|
|
}
|
|
}
|
|
-
|
|
|
|
- circuitmux_assert_okay_paranoid(cmux);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1592,282 +1244,6 @@ circuitmux_notify_xmit_destroy(circuitmux_t *cmux)
|
|
I64_PRINTF_ARG(global_destroy_ctr));
|
|
I64_PRINTF_ARG(global_destroy_ctr));
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- * Circuitmux consistency checking assertions
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Check that circuitmux data structures are consistent and fail with an
|
|
|
|
- * assert if not.
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-void
|
|
|
|
-circuitmux_assert_okay(circuitmux_t *cmux)
|
|
|
|
-{
|
|
|
|
- tor_assert(cmux);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Pass 1: iterate the hash table; for each entry:
|
|
|
|
- * a) Check that the circuit has this cmux for n_mux or p_mux
|
|
|
|
- * b) If the cell_count is > 0, set the mark bit; otherwise clear it
|
|
|
|
- * c) Also check activeness (cell_count > 0 should be active)
|
|
|
|
- * d) Count the number of circuits, active circuits and queued cells
|
|
|
|
- * and at the end check that they match the counters in the cmux.
|
|
|
|
- *
|
|
|
|
- * Pass 2: iterate the active circuits list; for each entry,
|
|
|
|
- * make sure the circuit is attached to this mux and appears
|
|
|
|
- * in the hash table. Make sure the mark bit is 1, and clear
|
|
|
|
- * it in the hash table entry. Consistency-check the linked
|
|
|
|
- * list pointers.
|
|
|
|
- *
|
|
|
|
- * Pass 3: iterate the hash table again; assert if any active circuits
|
|
|
|
- * (mark bit set to 1) are discovered that weren't cleared in pass 2
|
|
|
|
- * (don't appear in the linked list).
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- circuitmux_assert_okay_pass_one(cmux);
|
|
|
|
- circuitmux_assert_okay_pass_two(cmux);
|
|
|
|
- circuitmux_assert_okay_pass_three(cmux);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Do the first pass of circuitmux_assert_okay(); see the comment in that
|
|
|
|
- * function.
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-static void
|
|
|
|
-circuitmux_assert_okay_pass_one(circuitmux_t *cmux)
|
|
|
|
-{
|
|
|
|
- chanid_circid_muxinfo_t **i = NULL;
|
|
|
|
- uint64_t chan_id;
|
|
|
|
- channel_t *chan;
|
|
|
|
- circid_t circ_id;
|
|
|
|
- circuit_t *circ;
|
|
|
|
- or_circuit_t *or_circ;
|
|
|
|
- circuit_t **next_p, **prev_p;
|
|
|
|
- unsigned int n_circuits, n_active_circuits, n_cells;
|
|
|
|
-
|
|
|
|
- tor_assert(cmux);
|
|
|
|
- tor_assert(cmux->chanid_circid_map);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- n_circuits = n_active_circuits = n_cells = 0;
|
|
|
|
-
|
|
|
|
- i = HT_START(chanid_circid_muxinfo_map, cmux->chanid_circid_map);
|
|
|
|
- while (i) {
|
|
|
|
-
|
|
|
|
- tor_assert(*i);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- chan_id = (*i)->chan_id;
|
|
|
|
- circ_id = (*i)->circ_id;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- chan = channel_find_by_global_id(chan_id);
|
|
|
|
- tor_assert(chan);
|
|
|
|
- circ = circuit_get_by_circid_channel_even_if_marked(circ_id, chan);
|
|
|
|
- tor_assert(circ);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert((*i)->muxinfo.direction == CELL_DIRECTION_OUT ||
|
|
|
|
- (*i)->muxinfo.direction == CELL_DIRECTION_IN);
|
|
|
|
-
|
|
|
|
- if ((*i)->muxinfo.direction == CELL_DIRECTION_OUT) {
|
|
|
|
-
|
|
|
|
- tor_assert(cmux == circ->n_mux);
|
|
|
|
- tor_assert(chan == circ->n_chan);
|
|
|
|
-
|
|
|
|
- next_p = &(circ->next_active_on_n_chan);
|
|
|
|
- prev_p = &(circ->prev_active_on_n_chan);
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- or_circ = TO_OR_CIRCUIT(circ);
|
|
|
|
- tor_assert(cmux == or_circ->p_mux);
|
|
|
|
- tor_assert(chan == or_circ->p_chan);
|
|
|
|
-
|
|
|
|
- next_p = &(or_circ->next_active_on_p_chan);
|
|
|
|
- prev_p = &(or_circ->prev_active_on_p_chan);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Should this circuit be active? I.e., does the mux know about > 0
|
|
|
|
- * cells on it?
|
|
|
|
- */
|
|
|
|
- const int circ_is_active = ((*i)->muxinfo.cell_count > 0);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (circ_is_active) {
|
|
|
|
-
|
|
|
|
- tor_assert(*next_p || (circ == cmux->active_circuits_tail));
|
|
|
|
-
|
|
|
|
- tor_assert(*prev_p || (circ == cmux->active_circuits_head));
|
|
|
|
-
|
|
|
|
- ++n_active_circuits;
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- tor_assert(!(*next_p));
|
|
|
|
- tor_assert(!(*prev_p));
|
|
|
|
-
|
|
|
|
- tor_assert(circ != cmux->active_circuits_head);
|
|
|
|
- tor_assert(circ != cmux->active_circuits_tail);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- ++n_circuits;
|
|
|
|
-
|
|
|
|
- n_cells += (*i)->muxinfo.cell_count;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- (*i)->muxinfo.mark = circ_is_active;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- i = HT_NEXT(chanid_circid_muxinfo_map, cmux->chanid_circid_map, i);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert(n_cells == cmux->n_cells);
|
|
|
|
- tor_assert(n_circuits == cmux->n_circuits);
|
|
|
|
- tor_assert(n_active_circuits == cmux->n_active_circuits);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Do the second pass of circuitmux_assert_okay(); see the comment in that
|
|
|
|
- * function.
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-static void
|
|
|
|
-circuitmux_assert_okay_pass_two(circuitmux_t *cmux)
|
|
|
|
-{
|
|
|
|
- circuit_t *curr_circ, *prev_circ = NULL, *next_circ;
|
|
|
|
- or_circuit_t *curr_or_circ;
|
|
|
|
- uint64_t curr_chan_id;
|
|
|
|
- circid_t curr_circ_id;
|
|
|
|
- circuit_t **next_p, **prev_p;
|
|
|
|
- channel_t *chan;
|
|
|
|
- unsigned int n_active_circuits = 0;
|
|
|
|
- chanid_circid_muxinfo_t search, *hashent = NULL;
|
|
|
|
-
|
|
|
|
- tor_assert(cmux);
|
|
|
|
- tor_assert(cmux->chanid_circid_map);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Walk the linked list of active circuits in cmux; keep track of the
|
|
|
|
- * previous circuit seen for consistency checking purposes. Count them
|
|
|
|
- * to make sure the number in the linked list matches
|
|
|
|
- * cmux->n_active_circuits.
|
|
|
|
- */
|
|
|
|
- curr_circ = cmux->active_circuits_head;
|
|
|
|
- while (curr_circ) {
|
|
|
|
-
|
|
|
|
- chan = NULL;
|
|
|
|
- curr_or_circ = NULL;
|
|
|
|
- next_circ = NULL;
|
|
|
|
- next_p = prev_p = NULL;
|
|
|
|
- cell_direction_t direction;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (cmux == curr_circ->n_mux) {
|
|
|
|
-
|
|
|
|
- next_p = &(curr_circ->next_active_on_n_chan);
|
|
|
|
- prev_p = &(curr_circ->prev_active_on_n_chan);
|
|
|
|
-
|
|
|
|
- chan = curr_circ->n_chan;
|
|
|
|
-
|
|
|
|
- curr_circ_id = curr_circ->n_circ_id;
|
|
|
|
-
|
|
|
|
- direction = CELL_DIRECTION_OUT;
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- curr_or_circ = TO_OR_CIRCUIT(curr_circ);
|
|
|
|
- tor_assert(cmux == curr_or_circ->p_mux);
|
|
|
|
-
|
|
|
|
- next_p = &(curr_or_circ->next_active_on_p_chan);
|
|
|
|
- prev_p = &(curr_or_circ->prev_active_on_p_chan);
|
|
|
|
-
|
|
|
|
- chan = curr_or_circ->p_chan;
|
|
|
|
-
|
|
|
|
- curr_circ_id = curr_or_circ->p_circ_id;
|
|
|
|
-
|
|
|
|
- direction = CELL_DIRECTION_IN;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert(chan);
|
|
|
|
- curr_chan_id = chan->global_identifier;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert(*prev_p == prev_circ);
|
|
|
|
-
|
|
|
|
- if (!(*prev_p)) tor_assert(curr_circ == cmux->active_circuits_head);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- next_circ = *next_p;
|
|
|
|
-
|
|
|
|
- if (!(*next_p)) tor_assert(curr_circ == cmux->active_circuits_tail);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- search.chan_id = curr_chan_id;
|
|
|
|
- search.circ_id = curr_circ_id;
|
|
|
|
- hashent = HT_FIND(chanid_circid_muxinfo_map, cmux->chanid_circid_map,
|
|
|
|
- &search);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert(hashent);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert(direction == hashent->muxinfo.direction);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert(hashent->muxinfo.mark);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- hashent->muxinfo.mark = 0;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- ++n_active_circuits;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- prev_circ = curr_circ;
|
|
|
|
- curr_circ = next_circ;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tor_assert(n_active_circuits == cmux->n_active_circuits);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Do the third pass of circuitmux_assert_okay(); see the comment in that
|
|
|
|
- * function.
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-static void
|
|
|
|
-circuitmux_assert_okay_pass_three(circuitmux_t *cmux)
|
|
|
|
-{
|
|
|
|
- chanid_circid_muxinfo_t **i = NULL;
|
|
|
|
-
|
|
|
|
- tor_assert(cmux);
|
|
|
|
- tor_assert(cmux->chanid_circid_map);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- i = HT_START(chanid_circid_muxinfo_map, cmux->chanid_circid_map);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- while (i) {
|
|
|
|
-
|
|
|
|
- tor_assert(*i);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * Assert that this entry is not marked - i.e., that either we didn't
|
|
|
|
- * think it should be active in pass one or we saw it in the active
|
|
|
|
- * circuits linked list.
|
|
|
|
- */
|
|
|
|
- tor_assert(!((*i)->muxinfo.mark));
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- i = HT_NEXT(chanid_circid_muxinfo_map, cmux->chanid_circid_map, i);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
|
|
void
|
|
void
|
|
circuitmux_append_destroy_cell(channel_t *chan,
|
|
circuitmux_append_destroy_cell(channel_t *chan,
|