summaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2009-08-27 01:46:06 -0700
committerMike Perry <mikeperry-git@fscked.org>2009-09-16 15:48:52 -0700
commit04414830fe199d80bddf67c64e17d32d54a385e4 (patch)
treee62cd769904af16fd8e6268f431fac67e62ffb37 /src/or/or.h
parent7750bee21dda817611afd936558834bb21411301 (diff)
downloadtor-04414830fe199d80bddf67c64e17d32d54a385e4.tar.gz
tor-04414830fe199d80bddf67c64e17d32d54a385e4.zip
Implement the pareto fitting and timeout calculating bits.
Diffstat (limited to 'src/or/or.h')
-rw-r--r--src/or/or.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/or/or.h b/src/or/or.h
index be54ab4bf7..5e94a56e7c 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1890,6 +1890,8 @@ typedef struct crypt_path_t {
#define NCIRCUITS_TO_OBSERVE 10000 /* approx 3 weeks worth of circuits */
#define BUILDTIME_BIN_WIDTH 50
+/* TODO: This should be moved to the consensus */
+#define BUILDTIMEOUT_QUANTILE_CUTOFF 0.8
/** Information used to build a circuit. */
typedef struct {
@@ -1984,7 +1986,7 @@ typedef struct circuit_t {
time_t timestamp_created; /**< When was this circuit created? */
time_t timestamp_dirty; /**< When the circuit was first used, or 0 if the
* circuit is clean. */
- struct timeval highres_created; /**< When exactly was this circuit created? */
+ struct timeval highres_created; /**< When exactly was the circuit created? */
uint16_t marked_for_close; /**< Should we close this circuit at the end of
* the main loop? (If true, holds the line number
@@ -2695,7 +2697,6 @@ typedef struct {
config_line_t * BuildtimeHistogram;
uint16_t TotalBuildTimes;
-
/** What version of Tor wrote this state file? */
char *TorVersion;
@@ -2865,10 +2866,25 @@ void bridges_retry_all(void);
void entry_guards_free_all(void);
-void circuit_build_times_update_state(or_state_t *state);
-int circuit_build_times_parse_state(or_state_t *state, char **msg);
-
-
+/* Circuit Build Timeout "public" functions (I love C... No wait.) */
+typedef struct {
+ // XXX: Make this a smartlist..
+ uint16_t circuit_build_times[NCIRCUITS_TO_OBSERVE];
+ int build_times_idx;
+ int total_build_times;
+ int pre_timeouts;
+ uint16_t Xm;
+ double alpha;
+} circuit_build_times_t;
+
+extern circuit_build_times_t circ_times;
+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, char **msg);
+void circuit_build_times_add_timeout(circuit_build_times_t *cbt);
+void circuit_build_times_set_timeout(circuit_build_times_t *cbt);
+int circuit_build_times_add_time(circuit_build_times_t *cbt, long time);
/********************************* circuitlist.c ***********************/