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
*/
tor_assert(cmux);
tor_assert(circ);
+ circuitmux_assert_okay_paranoid(cmux);
+
/* Figure out our next_p and prev_p for this cmux/direction */
if (direction) {
if (direction == CELL_DIRECTION_OUT) {
*prev_p = cmux->active_circuits_tail;
/* Set the tail to this circuit */
cmux->active_circuits_tail = circ;
+
+ circuitmux_assert_okay_paranoid(cmux);
}
static INLINE circuit_t **
circuit_t *circ = NULL;
tor_assert(cmux);
+ circuitmux_assert_okay_paranoid(cmux);
i = HT_START(chanid_circid_muxinfo_map, cmux->chanid_circid_map);
while (i) {
tor_assert(circ);
tor_assert(direction == CELL_DIRECTION_IN ||
direction == CELL_DIRECTION_OUT);
+ circuitmux_assert_okay_paranoid(cmux);
/*
* Figure out which channel we're using, and get the circuit's current
}
cmux->n_cells += cell_count;
}
+
+ circuitmux_assert_okay_paranoid(cmux);
}
/**
tor_assert(cmux->chanid_circid_map);
tor_assert(circ);
tor_assert(circ->n_chan);
+ circuitmux_assert_okay_paranoid(cmux);
/* See if we have it for n_chan/n_circ_id */
search.chan_id = circ->n_chan->global_identifier;
/* Free the hash entry */
tor_free(hashent);
}
+
+ circuitmux_assert_okay_paranoid(cmux);
}
/**
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.
+ */
/* Get the right set of active list links for this direction */
if (direction == CELL_DIRECTION_OUT) {
cmux->policy->notify_circ_active(cmux, cmux->policy_data,
circ, hashent->muxinfo.policy_data);
}
+
+ circuitmux_assert_okay_paranoid(cmux);
}
/**
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.
+ */
/* Get the right set of active list links for this direction */
if (direction == CELL_DIRECTION_OUT) {
cmux->policy->notify_circ_inactive(cmux, cmux->policy_data,
circ, hashent->muxinfo.policy_data);
}
+
+ circuitmux_assert_okay_paranoid(cmux);
}
/**
tor_assert(cmux);
tor_assert(circ);
+ circuitmux_assert_okay_paranoid(cmux);
+
/* Search for this circuit's entry */
hashent = circuitmux_find_map_entry(cmux, circ);
/* Assert that we found one */
*/
if (hashent->muxinfo.cell_count > 0 && n_cells == 0) {
--(cmux->n_active_circuits);
+ hashent->muxinfo.cell_count = n_cells;
circuitmux_make_circuit_inactive(cmux, circ, hashent->muxinfo.direction);
/* Is the old cell count == 0 and the new cell count > 0 ? */
} else if (hashent->muxinfo.cell_count == 0 && n_cells > 0) {
++(cmux->n_active_circuits);
+ hashent->muxinfo.cell_count = n_cells;
circuitmux_make_circuit_active(cmux, circ, hashent->muxinfo.direction);
+ } 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;
}
- /* Update hash entry cell counter */
- hashent->muxinfo.cell_count = n_cells;
+ circuitmux_assert_okay_paranoid(cmux);
}
/*
tor_assert(cmux);
tor_assert(circ);
+ circuitmux_assert_okay_paranoid(cmux);
if (n_cells == 0) return;
--(cmux->n_active_circuits);
circuitmux_make_circuit_inactive(cmux, circ, hashent->muxinfo.direction);
}
+
+ circuitmux_assert_okay_paranoid(cmux);
}
/*