21 #include "core/or/channelpadding.h"
29 static size_t predicted_ports_total_alloc = 0;
56 time_t seconds_waited;
65 if (seconds_waited == TIME_MAX) {
76 if (BUG(seconds_left == TIME_MAX))
79 return (
int)(seconds_left);
100 "New port prediction added. Will continue predictive circ building "
101 "for %d more seconds.",
106 predicted_ports_total_alloc +=
sizeof(*pp);
123 if (pp->port == port) {
128 "New port prediction added. Will continue predictive circ "
129 "building for %d more seconds.",
133 } SMARTLIST_FOREACH_END(pp);
144 int predicted_circs_relevance_time;
152 if (pp->time + predicted_circs_relevance_time < now) {
153 log_debug(
LD_CIRC,
"Expiring predicted port %d", pp->port);
161 } SMARTLIST_FOREACH_END(pp);
179 predicted_ports_total_alloc -=
sizeof(*pp);
182 } SMARTLIST_FOREACH_END(pp);
183 bitarray_free(remove_ports);
216 "New port prediction added. Will continue predictive circ building "
217 "for %d more seconds.",
232 int predicted_circs_relevance_time;
255 int predicted_circs_relevance_time;
273 (!router_all_orports_seem_reachable(options) ||
292 predicted_ports_init(
void)
306 predicted_ports_total_alloc -=
Implements a variable-sized (but non-resizeable) bit-array.
static void bitarray_set(bitarray_t *b, int bit)
static unsigned int bitarray_is_set(bitarray_t *b, int bit)
static bitarray_t * bitarray_init_zero(unsigned int n_bits)
int channelpadding_get_circuits_available_timeout(void)
int circuit_enough_testing_circs(void)
Header file for circuituse.c.
const or_options_t * get_options(void)
Header file for config.c.
Master header file for Tor-specific functionality.
void rep_hist_note_used_port(time_t now, uint16_t port)
void rep_hist_remove_predicted_ports(const smartlist_t *rmv_ports)
static void predicted_ports_alloc(void)
int rep_hist_circbuilding_dormant(time_t now)
void rep_hist_note_used_internal(time_t now, int need_uptime, int need_capacity)
void rep_hist_note_used_resolve(time_t now)
int predicted_ports_prediction_time_remaining(time_t now)
static void add_predicted_port(time_t now, uint16_t port)
static time_t predicted_internal_uptime_time
static time_t last_prediction_add_time
static smartlist_t * predicted_ports_list
static time_t predicted_internal_time
static time_t prediction_timeout
int rep_hist_get_predicted_internal(time_t now, int *need_uptime, int *need_capacity)
int any_predicted_circuits(time_t now)
smartlist_t * rep_hist_get_predicted_ports(time_t now)
static time_t predicted_internal_capacity_time
void predicted_ports_free_all(void)
Header file for predict_ports.c.
int server_mode(const or_options_t *options)
Header file for routermode.c.
Header file for selftest.c.
smartlist_t * smartlist_new(void)
void smartlist_add(smartlist_t *sl, void *element)
#define SMARTLIST_FOREACH_BEGIN(sl, type, var)
#define SMARTLIST_FOREACH(sl, type, var, cmd)
#define SMARTLIST_DEL_CURRENT(sl, var)
time_t time_diff(const time_t t1, const time_t t2)