mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Move the circuit build timeout code into its own file.
This commit is contained in:
parent
9e9edf71f7
commit
907db008ab
@ -1,2 +1,4 @@
|
||||
o Code simplification and refactoring:
|
||||
- Move the entry node code from circuitbuild.c to its own file.
|
||||
- Move the circuit build timeout tracking code from circuitbuild.c
|
||||
to its own file.
|
||||
|
@ -18,8 +18,10 @@
|
||||
#include "channeltls.h"
|
||||
#include "circuitbuild.h"
|
||||
#include "circuitlist.h"
|
||||
#include "circuitstats.h"
|
||||
#include "connection_or.h" /* For var_cell_free() */
|
||||
#include "circuitmux.h"
|
||||
#include "entrynodes.h"
|
||||
#include "geoip.h"
|
||||
#include "nodelist.h"
|
||||
#include "relay.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -51,95 +51,5 @@ void extend_info_free(extend_info_t *info);
|
||||
const node_t *build_state_get_exit_node(cpath_build_state_t *state);
|
||||
const char *build_state_get_exit_nickname(cpath_build_state_t *state);
|
||||
|
||||
void entry_guards_compute_status(const or_options_t *options, time_t now);
|
||||
int entry_guard_register_connect_status(const char *digest, int succeeded,
|
||||
int mark_relay_status, time_t now);
|
||||
void entry_nodes_should_be_added(void);
|
||||
int entry_list_is_constrained(const or_options_t *options);
|
||||
const node_t *choose_random_entry(cpath_build_state_t *state);
|
||||
int entry_guards_parse_state(or_state_t *state, int set, char **msg);
|
||||
void entry_guards_update_state(or_state_t *state);
|
||||
int getinfo_helper_entry_guards(control_connection_t *conn,
|
||||
const char *question, char **answer,
|
||||
const char **errmsg);
|
||||
|
||||
void mark_bridge_list(void);
|
||||
void sweep_bridge_list(void);
|
||||
|
||||
int routerinfo_is_a_configured_bridge(const routerinfo_t *ri);
|
||||
int node_is_a_configured_bridge(const node_t *node);
|
||||
void learned_router_identity(const tor_addr_t *addr, uint16_t port,
|
||||
const char *digest);
|
||||
void bridge_add_from_config(const tor_addr_t *addr, uint16_t port,
|
||||
const char *digest,
|
||||
const char *transport_name);
|
||||
void retry_bridge_descriptor_fetch_directly(const char *digest);
|
||||
void fetch_bridge_descriptors(const or_options_t *options, time_t now);
|
||||
void learned_bridge_descriptor(routerinfo_t *ri, int from_cache);
|
||||
int any_bridge_descriptors_known(void);
|
||||
int any_pending_bridge_descriptor_fetches(void);
|
||||
int entries_known_but_down(const or_options_t *options);
|
||||
void entries_retry_all(const or_options_t *options);
|
||||
|
||||
int any_bridges_dont_support_microdescriptors(void);
|
||||
|
||||
void entry_guards_free_all(void);
|
||||
|
||||
extern circuit_build_times_t circ_times;
|
||||
int circuit_build_times_enough_to_compute(circuit_build_times_t *cbt);
|
||||
void circuit_build_times_update_state(circuit_build_times_t *cbt,
|
||||
or_state_t *state);
|
||||
int circuit_build_times_parse_state(circuit_build_times_t *cbt,
|
||||
or_state_t *state);
|
||||
void circuit_build_times_count_timeout(circuit_build_times_t *cbt,
|
||||
int did_onehop);
|
||||
int circuit_build_times_count_close(circuit_build_times_t *cbt,
|
||||
int did_onehop, time_t start_time);
|
||||
void circuit_build_times_set_timeout(circuit_build_times_t *cbt);
|
||||
int circuit_build_times_add_time(circuit_build_times_t *cbt,
|
||||
build_time_t time);
|
||||
int circuit_build_times_needs_circuits(circuit_build_times_t *cbt);
|
||||
|
||||
int circuit_build_times_needs_circuits_now(circuit_build_times_t *cbt);
|
||||
void circuit_build_times_init(circuit_build_times_t *cbt);
|
||||
void circuit_build_times_free_timeouts(circuit_build_times_t *cbt);
|
||||
void circuit_build_times_new_consensus_params(circuit_build_times_t *cbt,
|
||||
networkstatus_t *ns);
|
||||
double circuit_build_times_timeout_rate(const circuit_build_times_t *cbt);
|
||||
double circuit_build_times_close_rate(const circuit_build_times_t *cbt);
|
||||
|
||||
#ifdef CIRCUIT_PRIVATE
|
||||
double circuit_build_times_calculate_timeout(circuit_build_times_t *cbt,
|
||||
double quantile);
|
||||
build_time_t circuit_build_times_generate_sample(circuit_build_times_t *cbt,
|
||||
double q_lo, double q_hi);
|
||||
void circuit_build_times_initial_alpha(circuit_build_times_t *cbt,
|
||||
double quantile, double time_ms);
|
||||
int circuit_build_times_update_alpha(circuit_build_times_t *cbt);
|
||||
double circuit_build_times_cdf(circuit_build_times_t *cbt, double x);
|
||||
void circuitbuild_running_unit_tests(void);
|
||||
void circuit_build_times_reset(circuit_build_times_t *cbt);
|
||||
|
||||
/* Network liveness functions */
|
||||
int circuit_build_times_network_check_changed(circuit_build_times_t *cbt);
|
||||
#endif
|
||||
|
||||
/* Network liveness functions */
|
||||
void circuit_build_times_network_is_live(circuit_build_times_t *cbt);
|
||||
int circuit_build_times_network_check_live(circuit_build_times_t *cbt);
|
||||
void circuit_build_times_network_circ_success(circuit_build_times_t *cbt);
|
||||
|
||||
/* DOCDOC circuit_build_times_get_bw_scale */
|
||||
int circuit_build_times_get_bw_scale(networkstatus_t *ns);
|
||||
|
||||
/* DOCDOC find_transport_name_by_bridge_addrport */
|
||||
const char *find_transport_name_by_bridge_addrport(const tor_addr_t *addr,
|
||||
uint16_t port);
|
||||
struct transport_t;
|
||||
int find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port,
|
||||
const struct transport_t **transport);
|
||||
|
||||
int validate_pluggable_transports_config(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "circuitbuild.h"
|
||||
#include "circuitlist.h"
|
||||
#include "circuituse.h"
|
||||
#include "circuitstats.h"
|
||||
#include "connection.h"
|
||||
#include "config.h"
|
||||
#include "connection_edge.h"
|
||||
|
1569
src/or/circuitstats.c
Normal file
1569
src/or/circuitstats.c
Normal file
File diff suppressed because it is too large
Load Diff
65
src/or/circuitstats.h
Normal file
65
src/or/circuitstats.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* Copyright (c) 2001 Matej Pfajfar.
|
||||
* Copyright (c) 2001-2004, Roger Dingledine.
|
||||
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
||||
* Copyright (c) 2007-2012, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
/**
|
||||
* \file circuitstats.h
|
||||
* \brief Header file for circuitstats.c
|
||||
**/
|
||||
|
||||
#ifndef TOR_CIRCUITSTATS_H
|
||||
#define TOR_CIRCUITSTATS_H
|
||||
|
||||
extern circuit_build_times_t circ_times;
|
||||
|
||||
int circuit_build_times_disabled(void);
|
||||
int circuit_build_times_enough_to_compute(circuit_build_times_t *cbt);
|
||||
void circuit_build_times_update_state(circuit_build_times_t *cbt,
|
||||
or_state_t *state);
|
||||
int circuit_build_times_parse_state(circuit_build_times_t *cbt,
|
||||
or_state_t *state);
|
||||
void circuit_build_times_count_timeout(circuit_build_times_t *cbt,
|
||||
int did_onehop);
|
||||
int circuit_build_times_count_close(circuit_build_times_t *cbt,
|
||||
int did_onehop, time_t start_time);
|
||||
void circuit_build_times_set_timeout(circuit_build_times_t *cbt);
|
||||
int circuit_build_times_add_time(circuit_build_times_t *cbt,
|
||||
build_time_t time);
|
||||
int circuit_build_times_needs_circuits(circuit_build_times_t *cbt);
|
||||
|
||||
int circuit_build_times_needs_circuits_now(circuit_build_times_t *cbt);
|
||||
void circuit_build_times_init(circuit_build_times_t *cbt);
|
||||
void circuit_build_times_free_timeouts(circuit_build_times_t *cbt);
|
||||
void circuit_build_times_new_consensus_params(circuit_build_times_t *cbt,
|
||||
networkstatus_t *ns);
|
||||
double circuit_build_times_timeout_rate(const circuit_build_times_t *cbt);
|
||||
double circuit_build_times_close_rate(const circuit_build_times_t *cbt);
|
||||
|
||||
#ifdef CIRCUITSTATS_PRIVATE
|
||||
double circuit_build_times_calculate_timeout(circuit_build_times_t *cbt,
|
||||
double quantile);
|
||||
build_time_t circuit_build_times_generate_sample(circuit_build_times_t *cbt,
|
||||
double q_lo, double q_hi);
|
||||
void circuit_build_times_initial_alpha(circuit_build_times_t *cbt,
|
||||
double quantile, double time_ms);
|
||||
int circuit_build_times_update_alpha(circuit_build_times_t *cbt);
|
||||
double circuit_build_times_cdf(circuit_build_times_t *cbt, double x);
|
||||
void circuitbuild_running_unit_tests(void);
|
||||
void circuit_build_times_reset(circuit_build_times_t *cbt);
|
||||
|
||||
/* Network liveness functions */
|
||||
int circuit_build_times_network_check_changed(circuit_build_times_t *cbt);
|
||||
#endif
|
||||
|
||||
/* Network liveness functions */
|
||||
void circuit_build_times_network_is_live(circuit_build_times_t *cbt);
|
||||
int circuit_build_times_network_check_live(circuit_build_times_t *cbt);
|
||||
void circuit_build_times_network_circ_success(circuit_build_times_t *cbt);
|
||||
|
||||
/* DOCDOC circuit_build_times_get_bw_scale */
|
||||
int circuit_build_times_get_bw_scale(networkstatus_t *ns);
|
||||
|
||||
#endif
|
||||
|
@ -13,11 +13,13 @@
|
||||
#include "channel.h"
|
||||
#include "circuitbuild.h"
|
||||
#include "circuitlist.h"
|
||||
#include "circuitstats.h"
|
||||
#include "circuituse.h"
|
||||
#include "config.h"
|
||||
#include "connection.h"
|
||||
#include "connection_edge.h"
|
||||
#include "control.h"
|
||||
#include "entrynodes.h"
|
||||
#include "nodelist.h"
|
||||
#include "networkstatus.h"
|
||||
#include "policies.h"
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "dirserv.h"
|
||||
#include "dirvote.h"
|
||||
#include "dns.h"
|
||||
#include "entrynodes.h"x
|
||||
#include "geoip.h"
|
||||
#include "hibernate.h"
|
||||
#include "main.h"
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "dirserv.h"
|
||||
#include "dns.h"
|
||||
#include "dnsserv.h"
|
||||
#include "entrynodes.h"
|
||||
#include "geoip.h"
|
||||
#include "main.h"
|
||||
#include "policies.h"
|
||||
|
@ -21,12 +21,14 @@
|
||||
#include "channeltls.h"
|
||||
#include "circuitbuild.h"
|
||||
#include "circuitlist.h"
|
||||
#include "circuitstats.h"
|
||||
#include "command.h"
|
||||
#include "config.h"
|
||||
#include "connection.h"
|
||||
#include "connection_or.h"
|
||||
#include "control.h"
|
||||
#include "dirserv.h"
|
||||
#include "entrynodes.h"
|
||||
#include "geoip.h"
|
||||
#include "main.h"
|
||||
#include "networkstatus.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "channeltls.h"
|
||||
#include "circuitbuild.h"
|
||||
#include "circuitlist.h"
|
||||
#include "circuitstats.h"
|
||||
#include "circuituse.h"
|
||||
#include "config.h"
|
||||
#include "confparse.h"
|
||||
@ -26,6 +27,7 @@
|
||||
#include "directory.h"
|
||||
#include "dirserv.h"
|
||||
#include "dnsserv.h"
|
||||
#include "entrynodes.h"
|
||||
#include "geoip.h"
|
||||
#include "hibernate.h"
|
||||
#include "main.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "directory.h"
|
||||
#include "dirserv.h"
|
||||
#include "dirvote.h"
|
||||
#include "entrynodes.h"
|
||||
#include "geoip.h"
|
||||
#include "main.h"
|
||||
#include "microdesc.h"
|
||||
|
@ -23,6 +23,7 @@ src_or_libtor_a_SOURCES = \
|
||||
src/or/circuitlist.c \
|
||||
src/or/circuitmux.c \
|
||||
src/or/circuitmux_ewma.c \
|
||||
src/or/circuitstats.c \
|
||||
src/or/circuituse.c \
|
||||
src/or/command.c \
|
||||
src/or/config.c \
|
||||
@ -38,6 +39,7 @@ src_or_libtor_a_SOURCES = \
|
||||
src/or/dns.c \
|
||||
src/or/dnsserv.c \
|
||||
src/or/geoip.c \
|
||||
src/or/entrynodes.c \
|
||||
src/or/hibernate.c \
|
||||
src/or/main.c \
|
||||
src/or/microdesc.c \
|
||||
@ -96,6 +98,7 @@ ORHEADERS = \
|
||||
src/or/circuitlist.h \
|
||||
src/or/circuitmux.h \
|
||||
src/or/circuitmux_ewma.h \
|
||||
src/or/circuitstats.h \
|
||||
src/or/circuituse.h \
|
||||
src/or/command.h \
|
||||
src/or/config.h \
|
||||
@ -112,6 +115,7 @@ ORHEADERS = \
|
||||
src/or/dnsserv.h \
|
||||
src/or/eventdns_tor.h \
|
||||
src/or/geoip.h \
|
||||
src/or/entrynodes.h \
|
||||
src/or/hibernate.h \
|
||||
src/or/main.h \
|
||||
src/or/microdesc.h \
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "dirvote.h"
|
||||
#include "dns.h"
|
||||
#include "dnsserv.h"
|
||||
#include "entrynodes.h"
|
||||
#include "geoip.h"
|
||||
#include "hibernate.h"
|
||||
#include "main.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "config.h"
|
||||
#include "directory.h"
|
||||
#include "dirserv.h"
|
||||
#include "entrynodes.h"
|
||||
#include "microdesc.h"
|
||||
#include "networkstatus.h"
|
||||
#include "nodelist.h"
|
||||
|
@ -12,9 +12,9 @@
|
||||
|
||||
#include "or.h"
|
||||
#include "channel.h"
|
||||
#include "circuitbuild.h"
|
||||
#include "circuitmux.h"
|
||||
#include "circuitmux_ewma.h"
|
||||
#include "circuitstats.h"
|
||||
#include "config.h"
|
||||
#include "connection.h"
|
||||
#include "connection_or.h"
|
||||
@ -22,6 +22,7 @@
|
||||
#include "directory.h"
|
||||
#include "dirserv.h"
|
||||
#include "dirvote.h"
|
||||
#include "entrynodes.h"
|
||||
#include "main.h"
|
||||
#include "microdesc.h"
|
||||
#include "networkstatus.h"
|
||||
|
@ -13,13 +13,14 @@
|
||||
|
||||
#define ROUTERLIST_PRIVATE
|
||||
#include "or.h"
|
||||
#include "circuitbuild.h"
|
||||
#include "circuitstats.h"
|
||||
#include "config.h"
|
||||
#include "connection.h"
|
||||
#include "control.h"
|
||||
#include "directory.h"
|
||||
#include "dirserv.h"
|
||||
#include "dirvote.h"
|
||||
#include "entrynodes.h"
|
||||
#include "geoip.h"
|
||||
#include "hibernate.h"
|
||||
#include "main.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "or.h"
|
||||
#include "config.h"
|
||||
#include "circuitbuild.h"
|
||||
#include "circuitstats.h"
|
||||
#include "dirserv.h"
|
||||
#include "dirvote.h"
|
||||
#include "policies.h"
|
||||
|
@ -5,9 +5,10 @@
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
#include "or.h"
|
||||
#include "circuitbuild.h"
|
||||
#include "circuitstats.h"
|
||||
#include "config.h"
|
||||
#include "confparse.h"
|
||||
#include "entrynodes.h"
|
||||
#include "hibernate.h"
|
||||
#include "rephist.h"
|
||||
#include "router.h"
|
||||
|
@ -32,7 +32,7 @@ const char tor_git_revision[] = "";
|
||||
#define CONFIG_PRIVATE
|
||||
#define GEOIP_PRIVATE
|
||||
#define ROUTER_PRIVATE
|
||||
#define CIRCUIT_PRIVATE
|
||||
#define CIRCUITSTATS_PRIVATE
|
||||
|
||||
/*
|
||||
* Linux doesn't provide lround in math.h by default, but mac os does...
|
||||
@ -44,7 +44,7 @@ double fabs(double x);
|
||||
|
||||
#include "or.h"
|
||||
#include "buffers.h"
|
||||
#include "circuitbuild.h"
|
||||
#include "circuitstats.h"
|
||||
#include "config.h"
|
||||
#include "connection_edge.h"
|
||||
#include "geoip.h"
|
||||
|
Loading…
Reference in New Issue
Block a user