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

[or-cvs] r10054: Add a new config option __DisablePredictedCircuits designed (in tor/trunk: . src/or)



Author: arma
Date: 2007-04-30 05:18:48 -0400 (Mon, 30 Apr 2007)
New Revision: 10054

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/circuituse.c
   tor/trunk/src/or/config.c
   tor/trunk/src/or/or.h
Log:
Add a new config option __DisablePredictedCircuits designed for
use by the controller, when we don't want Tor to build any circuits
preemptively.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-04-30 05:36:41 UTC (rev 10053)
+++ tor/trunk/ChangeLog	2007-04-30 09:18:48 UTC (rev 10054)
@@ -63,6 +63,9 @@
   o Minor features (other):
     - Correctly report Windows 95 OSR2 and Windows 98 SE.
     - More unit tests.
+    - Add a new config option __DisablePredictedCircuits designed for
+      use by the controller, when we don't want Tor to build any circuits
+      preemptively.
 
   o Removed features:
     - Removed support for the old binary "version 0" controller protocol.

Modified: tor/trunk/src/or/circuituse.c
===================================================================
--- tor/trunk/src/or/circuituse.c	2007-04-30 05:36:41 UTC (rev 10053)
+++ tor/trunk/src/or/circuituse.c	2007-04-30 09:18:48 UTC (rev 10054)
@@ -448,6 +448,7 @@
 circuit_build_needed_circs(time_t now)
 {
   static long time_to_new_circuit = 0;
+  or_options_t *options = get_options();
 
   /* launch a new circ for any pending streams that need one */
   connection_ap_attach_pending();
@@ -457,7 +458,7 @@
 
   if (time_to_new_circuit < now) {
     circuit_reset_failure_count(1);
-    time_to_new_circuit = now + get_options()->NewCircuitPeriod;
+    time_to_new_circuit = now + options->NewCircuitPeriod;
     if (proxy_mode(get_options()))
       addressmap_clean(now);
     circuit_expire_old_circuits(now);
@@ -472,7 +473,8 @@
     }
 #endif
   }
-  circuit_predict_and_launch_new();
+  if (!options->DisablePredictedCircuits)
+    circuit_predict_and_launch_new();
 }
 
 /** If the stream <b>conn</b> is a member of any of the linked

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2007-04-30 05:36:41 UTC (rev 10053)
+++ tor/trunk/src/or/config.c	2007-04-30 09:18:48 UTC (rev 10054)
@@ -123,7 +123,6 @@
   VAR("AccountingMax",       MEMUNIT,  AccountingMax,        "0 bytes"),
   VAR("AccountingStart",     STRING,   AccountingStart,      NULL),
   VAR("Address",             STRING,   Address,              NULL),
-  VAR("__AllDirActionsPrivate",BOOL,   AllDirActionsPrivate, "0"),
   VAR("AllowInvalidNodes",   CSV,      AllowInvalidNodes,
                                                         "middle,rendezvous"),
   VAR("AllowNonRFC953Hostnames", BOOL, AllowNonRFC953Hostnames, "0"),
@@ -258,6 +257,8 @@
   VAR("V1AuthoritativeDirectory",BOOL, V1AuthoritativeDir,   "0"),
   VAR("VersioningAuthoritativeDirectory",BOOL,VersioningAuthoritativeDir, "0"),
   VAR("VirtualAddrNetwork",  STRING,   VirtualAddrNetwork,   "127.192.0.0/10"),
+  VAR("__AllDirActionsPrivate",BOOL,   AllDirActionsPrivate, "0"),
+  VAR("__DisablePredictedCircuits",BOOL,DisablePredictedCircuits,"0"),
   VAR("__LeaveStreamsUnattached", BOOL,LeaveStreamsUnattached, "0"),
   { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL }
 };

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-04-30 05:36:41 UTC (rev 10053)
+++ tor/trunk/src/or/or.h	2007-04-30 09:18:48 UTC (rev 10054)
@@ -1820,6 +1820,9 @@
   int LeaveStreamsUnattached; /**< Boolean: Does Tor attach new streams to
                           * circuits itself (0), or does it expect a controller
                           * to cope? (1) */
+  int DisablePredictedCircuits; /**< Boolean: does Tor preemptively
+                                 * make circuits in the background (0),
+                                 * or not (1)? */
   int ShutdownWaitLength; /**< When we get a SIGINT and we're a server, how
                            * long do we wait before exiting? */
   int SafeLogging; /**< Boolean: are we allowed to log sensitive strings