aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-10-30 23:00:52 -0400
committerNick Mathewson <nickm@torproject.org>2013-10-30 23:03:20 -0400
commitf6fee77375d246d3607b82577464a499685c1ce6 (patch)
treeeb3b4b424f06a7347ed7330ad75b3b013b5edb88 /src
parent83d9d72bf3bab62e2659ac7060b874ee5ba1c416 (diff)
downloadtor-f6fee77375d246d3607b82577464a499685c1ce6.tar
tor-f6fee77375d246d3607b82577464a499685c1ce6.tar.gz
Add some clarity and checks to cell_queue_append_packed_copy
It's not cool to have "circ may be NULL if use_stats false, but otherwise we crash" as an undocumented API constraint. :)
Diffstat (limited to 'src')
-rw-r--r--src/or/relay.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index 7947ca373..e0b5d26fe 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -2204,7 +2204,9 @@ cell_command_queue_pop(uint8_t *command, cell_queue_t *queue)
}
/** Append a newly allocated copy of <b>cell</b> to the end of the
- * <b>exitward</b> (or app-ward) <b>queue</b> of <b>circ</b>. */
+ * <b>exitward</b> (or app-ward) <b>queue</b> of <b>circ</b>. If
+ * <b>use_stats</b> is true, record statistics about the cell.
+ */
void
cell_queue_append_packed_copy(circuit_t *circ, cell_queue_t *queue,
int exitward, const cell_t *cell,
@@ -2244,7 +2246,7 @@ cell_queue_append_packed_copy(circuit_t *circ, cell_queue_t *queue,
}
/* Remember that we added a cell to the queue, and remember the cell
* command. */
- if (get_options()->TestingEnableCellStatsEvent) {
+ if (get_options()->TestingEnableCellStatsEvent && circ) {
testing_cell_stats_entry_t *ent =
tor_malloc_zero(sizeof(testing_cell_stats_entry_t));
ent->command = cell->command;