[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [or-cvs] [tor/master 3/3] Move exit-stats code to the end of rephist.c.



On Fri, Aug 06, 2010 at 02:45:57PM +0000, nickm@xxxxxxxxxxxxxx wrote:
> Author: Karsten Loesing <karsten.loesing@xxxxxxx>
> Date: Wed, 4 Aug 2010 07:32:10 +0200
> Subject: Move exit-stats code to the end of rephist.c.
> Commit: 83626ec91c4d0de610f59bc43a1e5d0dd4103d87
[snip]
> -/** Free all storage held by the OR/link history caches, by the
> - * bandwidth history arrays, or by the port history. */
>  void
> -rep_hist_free_all(void)
[snip]
> +/** Stop collecting exit port stats in a way that we can re-start doing
> + * so in rep_hist_exit_stats_init(). */
> +void
> +rep_hist_exit_stats_term(void)
> +{
> +  start_of_exit_stats_interval = 0;
>    tor_free(exit_bytes_read);
>    tor_free(exit_bytes_written);
>    tor_free(exit_streams);
> -  built_last_stability_doc_at = 0;
> -  predicted_ports_free();
> +}
> +
[snip]
> +/** Free all storage held by the OR/link history caches, by the
> + * bandwidth history arrays, by the port history, or by statistics . */
> +void
> +rep_hist_free_all(void)
> +{
> +  digestmap_free(history_map, free_or_history);
> +  tor_free(read_array);
> +  tor_free(write_array);
> +  tor_free(last_stability_doc);
> +  tor_free(exit_bytes_read);
> +  tor_free(exit_bytes_written);
> +  tor_free(exit_streams);
> +  built_last_stability_doc_at = 0;
> +  predicted_ports_free();
> +}

Hi Karsten,

It would be good in the future to do this sort of change as two commits --
one that moves the huge chunks of code from one file to another, and a
second that actually modifies what the code is. Otherwise when reviewing,
we have to memorize all the removed lines and recognize them when they
reappear, so we can learn what actually changed.

--Roger