aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-03-21 03:03:10 +0000
committerNick Mathewson <nickm@torproject.org>2004-03-21 03:03:10 +0000
commitb7c2b18bd696f79e6866ae70c58373dfbedf91f0 (patch)
tree4674f7f0ab23e4b4d4c148c832cdf1a76092fadc /src/or/main.c
parent0d8feba6d8225f012cadbfccb001236260f83bf5 (diff)
downloadtor-b7c2b18bd696f79e6866ae70c58373dfbedf91f0.tar
tor-b7c2b18bd696f79e6866ae70c58373dfbedf91f0.tar.gz
Add a RunTesting option to try to learn link state by creating test circuits, even when SocksPort is off.
svn:r1327
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 86ea5923e..491a5ef82 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -354,10 +354,14 @@ static void run_scheduled_events(time_t now) {
* that became dirty more than NewCircuitPeriod seconds ago,
* and we make a new circ if there are no clean circuits.
*/
- if(options.SocksPort) {
+ if(options.SocksPort || options.RunTesting) {
+
+ if (options.SocksPort)
+ /* launch a new circ for any pending streams that need one */
+ connection_ap_attach_pending();
- /* launch a new circ for any pending streams that need one */
- connection_ap_attach_pending();
+/* Build a new test circuit every 5 minutes */
+#define TESTING_CIRCUIT_INTERVAL 300
circ = circuit_get_newest(NULL, 1);
if(time_to_new_circuit < now) {
@@ -367,6 +371,10 @@ static void run_scheduled_events(time_t now) {
if(circ && circ->timestamp_dirty) {
log_fn(LOG_INFO,"Youngest circuit dirty; launching replacement.");
circuit_launch_new(); /* make a new circuit */
+ } else if (options.RunTesting && circ &&
+ circ->timestamp_created + TESTING_CIRCUIT_INTERVAL < now) {
+ log_fn(LOG_INFO,"Creating a new testing circuit.");
+ circuit_launch_new();
}
time_to_new_circuit = now + options.NewCircuitPeriod;
}