aboutsummaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2009-07-12 16:33:31 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2009-07-15 16:12:45 +0200
commit3c051325758c0aeeeb44054715e16d8b8717948c (patch)
treea9e595b28ce218f3998ed0d3a10f54fc55eefd4e /src/or/or.h
parent72c5a46b43c6d89c773a99240a95301b91b1f269 (diff)
downloadtor-3c051325758c0aeeeb44054715e16d8b8717948c.tar.gz
tor-3c051325758c0aeeeb44054715e16d8b8717948c.zip
Directories now also measure download times of network statuses.
Diffstat (limited to 'src/or/or.h')
-rw-r--r--src/or/or.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h
index c18ef15faf..035d4edc0a 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -970,6 +970,10 @@ typedef struct connection_t {
* to the evdns_server_port is uses to listen to and answer connections. */
struct evdns_server_port *dns_server_port;
+#ifdef ENABLE_GEOIP_STATS
+ /** Unique ID for measuring tunneled network status requests. */
+ uint64_t request_id;
+#endif
} connection_t;
/** Stores flags and information related to the portion of a v2 Tor OR
@@ -1956,6 +1960,10 @@ typedef struct circuit_t {
* linked to an OR connection. */
struct circuit_t *prev_active_on_n_conn;
struct circuit_t *next; /**< Next circuit in linked list of all circuits. */
+#ifdef ENABLE_GEOIP_STATS
+ /** Unique ID for measuring tunneled network status requests. */
+ uint64_t request_id;
+#endif
} circuit_t;
/** Largest number of relay_early cells that we can send on a given
@@ -3672,6 +3680,42 @@ int getinfo_helper_geoip(control_connection_t *control_conn,
const char *question, char **answer);
void geoip_free_all(void);
+/** Directory requests that we are measuring can be either direct or
+ * tunneled. */
+typedef enum {
+ REQUEST_DIRECT = 0,
+ REQUEST_TUNNELED = 1,
+} directory_request_type_t;
+
+/** Possible states for either direct or tunneled directory requests that
+ * are relevant for determining network status download times. */
+typedef enum {
+ /** Found that the client requests a network status; applies to both
+ * direct and tunneled requests; initial state of a request that we are
+ * measuring. */
+ REQUEST_IS_FOR_NETWORK_STATUS = 0,
+ /** Finished writing a network status to the directory connection;
+ * applies to both direct and tunneled requests; completes a direct
+ * request. */
+ FLUSHING_DIR_CONN_FINISHED = 1,
+ /** END cell sent to circuit that initiated a tunneled request. */
+ END_CELL_SENT = 2,
+ /** Flushed last cell from queue of the circuit that initiated a
+ * tunneled request to the outbuf of the OR connection. */
+ CIRC_QUEUE_FLUSHED = 3,
+ /** Flushed last byte from buffer of the OR connection belonging to the
+ * circuit that initiated a tunneled request; completes a tunneled
+ * request. */
+ OR_CONN_BUFFER_FLUSHED = 4
+} directory_request_state_t;
+
+void geoip_start_dirreq(uint64_t request_id, size_t response_size,
+ geoip_client_action_t action,
+ directory_request_type_t type);
+void geoip_change_dirreq_state(uint64_t request_id,
+ directory_request_type_t type,
+ directory_request_state_t new_state);
+
/********************************* hibernate.c **********************/
int accounting_parse_options(or_options_t *options, int validate_only);