[tor-commits] [tor/master] Use dirreq_id from channel_t when appropriate
andrea at torproject.org
andrea at torproject.org
Thu Oct 11 02:05:22 UTC 2012
commit 28f108bcceab59fcf9f27e33065f64bfdb0f159a
Author: Andrea Shepard <andrea at persephoneslair.org>
Date: Tue Sep 4 00:33:16 2012 -0700
Use dirreq_id from channel_t when appropriate
---
src/or/channel.h | 5 -----
src/or/connection_edge.c | 4 ++--
src/or/directory.c | 8 ++++----
src/or/geoip.c | 6 +++---
4 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/src/or/channel.h b/src/or/channel.h
index 242a078..18d9a81 100644
--- a/src/or/channel.h
+++ b/src/or/channel.h
@@ -38,11 +38,6 @@ struct channel_s {
*/
unsigned int is_listener:1;
- /** Unique ID for measuring direct network status requests;vtunneled ones
- * come over a circuit_t, which has a dirreq_id field as well, but is a
- * distinct namespace. */
- uint64_t dirreq_id;
-
/** Why did we close?
*/
enum {
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 9bcfca3..834f970 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -3124,7 +3124,7 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ)
/* Remember the tunneled request ID in the new edge connection, so that
* we can measure download times. */
- TO_CONN(n_stream)->dirreq_id = circ->dirreq_id;
+ n_stream->dirreq_id = circ->dirreq_id;
n_stream->_base.purpose = EXIT_PURPOSE_CONNECT;
@@ -3366,7 +3366,7 @@ connection_exit_connect_dir(edge_connection_t *exitconn)
/* Note that the new dir conn belongs to the same tunneled request as
* the edge conn, so that we can measure download times. */
- TO_CONN(dirconn)->dirreq_id = TO_CONN(exitconn)->dirreq_id;
+ dirconn->dirreq_id = exitconn->dirreq_id;
connection_link_connections(TO_CONN(dirconn), TO_CONN(exitconn));
diff --git a/src/or/directory.c b/src/or/directory.c
index 7df91fb..8003444 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -2855,8 +2855,8 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
geoip_note_ns_response(act, GEOIP_SUCCESS);
/* Note that a request for a network status has started, so that we
* can measure the download time later on. */
- if (TO_CONN(conn)->dirreq_id)
- geoip_start_dirreq(TO_CONN(conn)->dirreq_id, dlen, act,
+ if (conn->dirreq_id)
+ geoip_start_dirreq(conn->dirreq_id, dlen, act,
DIRREQ_TUNNELED);
else
geoip_start_dirreq(TO_CONN(conn)->global_identifier, dlen, act,
@@ -3529,8 +3529,8 @@ connection_dir_finished_flushing(dir_connection_t *conn)
/* Note that we have finished writing the directory response. For direct
* connections this means we're done, for tunneled connections its only
* an intermediate step. */
- if (TO_CONN(conn)->dirreq_id)
- geoip_change_dirreq_state(TO_CONN(conn)->dirreq_id, DIRREQ_TUNNELED,
+ if (conn->dirreq_id)
+ geoip_change_dirreq_state(conn->dirreq_id, DIRREQ_TUNNELED,
DIRREQ_FLUSHING_DIR_CONN_FINISHED);
else
geoip_change_dirreq_state(TO_CONN(conn)->global_identifier,
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 6b7cc82..a995f8b 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -578,7 +578,7 @@ _c_hist_compare(const void **_a, const void **_b)
* failed, the others as still running. */
#define DIRREQ_TIMEOUT (10*60)
-/** Entry in a map from either conn->global_identifier for direct requests
+/** Entry in a map from either chan->global_identifier for direct requests
* or a unique circuit identifier for tunneled requests to request time,
* response size, and completion time of a network status request. Used to
* measure download times of requests to derive average client
@@ -586,7 +586,7 @@ _c_hist_compare(const void **_a, const void **_b)
typedef struct dirreq_map_entry_t {
HT_ENTRY(dirreq_map_entry_t) node;
/** Unique identifier for this network status request; this is either the
- * conn->global_identifier of the dir conn (direct request) or a new
+ * chan->global_identifier of the dir channel (direct request) or a new
* locally unique identifier of a circuit (tunneled request). This ID is
* only unique among other direct or tunneled requests, respectively. */
uint64_t dirreq_id;
@@ -705,7 +705,7 @@ geoip_change_dirreq_state(uint64_t dirreq_id, dirreq_type_t type,
if ((type == DIRREQ_DIRECT &&
new_state == DIRREQ_FLUSHING_DIR_CONN_FINISHED) ||
(type == DIRREQ_TUNNELED &&
- new_state == DIRREQ_OR_CONN_BUFFER_FLUSHED)) {
+ new_state == DIRREQ_CHANNEL_BUFFER_FLUSHED)) {
tor_gettimeofday(&ent->completion_time);
ent->completed = 1;
}
More information about the tor-commits
mailing list