From: Mike Perry Date: Mon, 17 Sep 2018 23:12:45 +0000 (+0000) Subject: Merge branch 'bug23512-v4-029' into bug23512-v4-032 X-Git-Tag: tor-0.3.5.2-alpha~18^2^2~1^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=36e81e1f59581f1dbc29ab44585a202463a99054;p=thirdparty%2Ftor.git Merge branch 'bug23512-v4-029' into bug23512-v4-032 --- 36e81e1f59581f1dbc29ab44585a202463a99054 diff --cc src/or/rephist.c index 345722d8ce,211480284a..4b9265875d --- a/src/or/rephist.c +++ b/src/or/rephist.c @@@ -84,14 -84,15 +84,19 @@@ #include "router.h" #include "routerlist.h" #include "ht.h" +#include "channelpadding.h" + +#include "channelpadding.h" +#include "connection_or.h" static void bw_arrays_init(void); -static void predicted_ports_init(void); +static void predicted_ports_alloc(void); + typedef struct bw_array_t bw_array_t; + STATIC uint64_t find_largest_max(bw_array_t *b); + STATIC void commit_max(bw_array_t *b); + STATIC void advance_obs(bw_array_t *b); + /** Total number of bytes currently allocated in fields used by rephist.c. */ uint64_t rephist_total_alloc=0; /** Number of or_history_t objects currently allocated. */ diff --cc src/or/rephist.h index 496e366865,837bb8d043..e67209d3ee --- a/src/or/rephist.h +++ b/src/or/rephist.h @@@ -116,32 -117,9 +116,34 @@@ extern uint32_t rephist_total_num #ifdef TOR_UNIT_TESTS extern int onion_handshakes_requested[MAX_ONION_HANDSHAKE_TYPE+1]; extern int onion_handshakes_assigned[MAX_ONION_HANDSHAKE_TYPE+1]; + typedef struct bw_array_t bw_array_t; + extern bw_array_t *write_array; #endif -#endif +/** + * Represents the type of a cell for padding accounting + */ +typedef enum padding_type_t { + /** A RELAY_DROP cell */ + PADDING_TYPE_DROP, + /** A CELL_PADDING cell */ + PADDING_TYPE_CELL, + /** Total counts of padding and non-padding together */ + PADDING_TYPE_TOTAL, + /** Total cell counts for all padding-enabled channels */ + PADDING_TYPE_ENABLED_TOTAL, + /** CELL_PADDING counts for all padding-enabled channels */ + PADDING_TYPE_ENABLED_CELL +} padding_type_t; + +/** The amount of time over which the padding cell counts were counted */ +#define REPHIST_CELL_PADDING_COUNTS_INTERVAL (24*60*60) +void rep_hist_padding_count_read(padding_type_t type); +void rep_hist_padding_count_write(padding_type_t type); +char *rep_hist_get_padding_count_lines(void); +void rep_hist_reset_padding_counts(void); +void rep_hist_prep_published_padding_counts(time_t now); +void rep_hist_padding_count_timers(uint64_t num_timers); + +#endif /* !defined(TOR_REPHIST_H) */