[tor-commits] [tor/maint-0.2.2] Add XXX023s for our timestamp_dirty abuse.

nickm at torproject.org nickm at torproject.org
Thu Apr 7 16:04:47 UTC 2011


commit f3b89c114112987b74bb0632cfe47a3a17859adb
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Mar 25 17:49:44 2011 -0400

    Add XXX023s for our timestamp_dirty abuse.
---
 src/or/circuitlist.c     |    3 +++
 src/or/connection_edge.c |    2 ++
 src/or/or.h              |   10 ++++++++--
 src/or/relay.c           |    2 ++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index b4f5f45..521c21e 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -1023,6 +1023,7 @@ circuit_mark_all_unused_circs(void)
  * This is useful for letting the user change pseudonyms, so new
  * streams will not be linkable to old streams.
  */
+/* XXX023 this is a bad name for what this function does */
 void
 circuit_expire_all_dirty_circs(void)
 {
@@ -1033,6 +1034,8 @@ circuit_expire_all_dirty_circs(void)
     if (CIRCUIT_IS_ORIGIN(circ) &&
         !circ->marked_for_close &&
         circ->timestamp_dirty)
+      /* XXXX023 This is a screwed-up way to say "This is too dirty
+       * for new circuits. */
       circ->timestamp_dirty -= options->MaxCircuitDirtiness;
   }
 }
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index c75c06b..af0cfbe 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -517,6 +517,7 @@ connection_ap_expire_beginning(void)
     /* kludge to make us not try this circuit again, yet to allow
      * current streams on it to survive if they can: make it
      * unattractive to use for new streams */
+    /* XXXX023 this is a kludgy way to do this. */
     tor_assert(circ->timestamp_dirty);
     circ->timestamp_dirty -= options->MaxCircuitDirtiness;
     /* give our stream another 'cutoff' seconds to try */
@@ -2164,6 +2165,7 @@ connection_ap_handshake_send_begin(edge_connection_t *ap_conn)
   ap_conn->stream_id = get_unique_stream_id_by_circ(circ);
   if (ap_conn->stream_id==0) {
     connection_mark_unattached_ap(ap_conn, END_STREAM_REASON_INTERNAL);
+    /*XXXX022 _close_ the circuit because it's full?  That sounds dumb. */
     circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_RESOURCELIMIT);
     return -1;
   }
diff --git a/src/or/or.h b/src/or/or.h
index 124892c..e44c626 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2127,8 +2127,14 @@ typedef struct circuit_t {
   char *n_conn_onionskin;
 
   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. */
+  /** When the circuit was first used, or 0 if the circuit is clean.
+   *
+   * XXXX023 Note that some code will artifically adjust this value backward
+   * in time in order to indicate that a circuit shouldn't be used for new
+   * streams, but that it can stay alive as long as it has streams on it.
+   * That's a kludge we should fix.
+   */
+  time_t timestamp_dirty;
   struct timeval highres_created; /**< When exactly was the circuit created? */
 
   uint16_t marked_for_close; /**< Should we close this circuit at the end of
diff --git a/src/or/relay.c b/src/or/relay.c
index 076b46b..807cb3d 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -791,6 +791,8 @@ connection_ap_process_end_not_open(
             < MAX_RESOLVE_FAILURES) {
           /* We haven't retried too many times; reattach the connection. */
           circuit_log_path(LOG_INFO,LD_APP,circ);
+          /* Mark this circuit "unusable for new streams". */
+          /* XXXX023 this is a kludgy way to do this. */
           tor_assert(circ->_base.timestamp_dirty);
           circ->_base.timestamp_dirty -= get_options()->MaxCircuitDirtiness;
 





More information about the tor-commits mailing list