[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] fix the first bug with our optimization to circuit_expire_b...



Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	circuituse.c 
Log Message:
fix the first bug with our optimization to circuit_expire_building():
we were killing off rendezvous circuits unless they magically time-warped
to be too old before we got around to killing them, in which case we
would leave them alone. this made it hard to rendezvous with hidden
services.


Index: circuituse.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuituse.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- circuituse.c	3 Dec 2005 16:32:29 -0000	1.95
+++ circuituse.c	4 Dec 2005 21:51:50 -0000	1.96
@@ -219,7 +219,6 @@
     }
 #endif
 
-
     /* if circ is !open, or if it's open but purpose is a non-finished
      * intro or rend, then mark it for close */
     if (victim->state == CIRCUIT_STATE_OPEN) {
@@ -232,20 +231,21 @@
            * IS_ORIGIN test above. */
           continue; /* yes, continue inside a switch refers to the nearest
                      * enclosing loop. C is smart. */
+
         case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
         case CIRCUIT_PURPOSE_C_INTRODUCING:
         case CIRCUIT_PURPOSE_S_ESTABLISH_INTRO:
           break;
         case CIRCUIT_PURPOSE_C_REND_READY:
           /* it's a rend_ready circ -- has it already picked a query? */
-          if (!victim->rend_query[0] && victim->timestamp_dirty > cutoff)
+          /* c_rend_ready circs measure age since timestamp_dirty,
+           * because that's set when they switch purposes
+           */
+          if (!victim->rend_query[0] || victim->timestamp_dirty <= cutoff)
             continue;
           break;
         case CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED:
         case CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT:
-          /* c_rend_ready circs measure age since timestamp_dirty,
-           * because that's set when they switch purposes
-           */
           /* rend and intro circs become dirty each time they
            * make an introduction attempt. so timestamp_dirty
            * will reflect the time since the last attempt.
@@ -1027,7 +1027,7 @@
 }
 
 /** If an exit wasn't specifically chosen, save the history for future
- * use */
+ * use. */
 static void
 consider_recording_trackhost(connection_t *conn, circuit_t *circ)
 {
@@ -1066,6 +1066,7 @@
         strlen("exit") + 1 /* '\0' */;
   new_address = tor_malloc(len);
 
+  //XXX need to use $key not nickname
   tor_snprintf(new_address, len, "%s.%s.exit",
                conn->socks_request->address,
                circ->build_state->chosen_exit->nickname);