mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
Minor fix to buffer stats.
Do not segfault when writing buffer stats when we haven't observed a single circuit to report about. This is a minor bug that would only show up in testing environments with no traffic and with reduced stats intervals.
This commit is contained in:
parent
0faf5c5fd2
commit
16fbb2f745
@ -2701,9 +2701,16 @@ rep_hist_buffer_stats_write(time_t now)
|
|||||||
memset(circs_in_share, 0, SHARES * sizeof(int));
|
memset(circs_in_share, 0, SHARES * sizeof(int));
|
||||||
memset(queued_cells, 0, SHARES * sizeof(double));
|
memset(queued_cells, 0, SHARES * sizeof(double));
|
||||||
memset(time_in_queue, 0, SHARES * sizeof(double));
|
memset(time_in_queue, 0, SHARES * sizeof(double));
|
||||||
|
if (!circuits_for_buffer_stats)
|
||||||
|
circuits_for_buffer_stats = smartlist_create();
|
||||||
smartlist_sort(circuits_for_buffer_stats,
|
smartlist_sort(circuits_for_buffer_stats,
|
||||||
_buffer_stats_compare_entries);
|
_buffer_stats_compare_entries);
|
||||||
number_of_circuits = smartlist_len(circuits_for_buffer_stats);
|
number_of_circuits = smartlist_len(circuits_for_buffer_stats);
|
||||||
|
if (number_of_circuits < 1) {
|
||||||
|
log_info(LD_HIST, "Attempt to write cell statistics to disk failed. "
|
||||||
|
"We haven't seen a single circuit to report about.");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
SMARTLIST_FOREACH_BEGIN(circuits_for_buffer_stats,
|
SMARTLIST_FOREACH_BEGIN(circuits_for_buffer_stats,
|
||||||
circ_buffer_stats_t *, stat)
|
circ_buffer_stats_t *, stat)
|
||||||
|
Loading…
Reference in New Issue
Block a user