mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
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. :)
This commit is contained in:
parent
83d9d72bf3
commit
f6fee77375
1 changed files with 4 additions and 2 deletions
|
@ -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
|
/** 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
|
void
|
||||||
cell_queue_append_packed_copy(circuit_t *circ, cell_queue_t *queue,
|
cell_queue_append_packed_copy(circuit_t *circ, cell_queue_t *queue,
|
||||||
int exitward, const cell_t *cell,
|
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
|
/* Remember that we added a cell to the queue, and remember the cell
|
||||||
* command. */
|
* command. */
|
||||||
if (get_options()->TestingEnableCellStatsEvent) {
|
if (get_options()->TestingEnableCellStatsEvent && circ) {
|
||||||
testing_cell_stats_entry_t *ent =
|
testing_cell_stats_entry_t *ent =
|
||||||
tor_malloc_zero(sizeof(testing_cell_stats_entry_t));
|
tor_malloc_zero(sizeof(testing_cell_stats_entry_t));
|
||||||
ent->command = cell->command;
|
ent->command = cell->command;
|
||||||
|
|
Loading…
Add table
Reference in a new issue