]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use dirreq_id from channel_t when appropriate
authorAndrea Shepard <andrea@persephoneslair.org>
Tue, 4 Sep 2012 07:33:16 +0000 (00:33 -0700)
committerAndrea Shepard <andrea@torproject.org>
Mon, 8 Oct 2012 10:06:09 +0000 (03:06 -0700)
src/or/channel.h
src/or/connection_edge.c
src/or/directory.c
src/or/geoip.c

index 242a078532d4c593714017449a97f450bc52ac53..18d9a81209a064b65db11768220202f1cc569dc0 100644 (file)
@@ -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 {
index 9bcfca30de36c380227cb7dbbfde141c660ef0f4..834f9707cea20ce5b937ac0b8e79d4d01412cbb9 100644 (file)
@@ -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));
 
index 7df91fb57ecb6f92c11633453000d2592831a232..8003444c6f61f6404b59c55e7575cc54d5227ce6 100644 (file)
@@ -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,
index 6b7cc82b822fa783b06c7ad3cc56ea40b1e101c4..a995f8b802a117b8ae1e58ec3ed3a6e0ac1d044a 100644 (file)
@@ -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;
   }