summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-07-22 07:15:34 +0000
committerRoger Dingledine <arma@torproject.org>2006-07-22 07:15:34 +0000
commita0ca86003e609703209ce08e84a28c71afcd7094 (patch)
treee81b7a8d1b893d09eddeec566780cc1c1ea84dd0
parent41cf27d1636dd01ca42c741c3093005a2e07c1b6 (diff)
downloadtor-a0ca86003e609703209ce08e84a28c71afcd7094.tar.gz
tor-a0ca86003e609703209ce08e84a28c71afcd7094.zip
i lied, that won't work at all. maybe this will.
svn:r6805
-rw-r--r--trunk/src/or/config.c3
-rw-r--r--trunk/src/or/main.c4
-rw-r--r--trunk/src/or/or.h1
-rw-r--r--trunk/src/or/rephist.c14
4 files changed, 14 insertions, 8 deletions
diff --git a/trunk/src/or/config.c b/trunk/src/or/config.c
index e0dd745a98..9c6577c07a 100644
--- a/trunk/src/or/config.c
+++ b/trunk/src/or/config.c
@@ -796,8 +796,7 @@ options_act(or_options_t *old_options)
return -1;
}
server_has_changed_ip();
- if (has_completed_circuit ||
- rep_hist_circbuilding_dormant(time(NULL)))
+ if (has_completed_circuit || any_predicted_circuits(time(NULL)))
inform_testing_reachability();
}
cpuworkers_rotate();
diff --git a/trunk/src/or/main.c b/trunk/src/or/main.c
index ca3742a5c9..cb0e74b374 100644
--- a/trunk/src/or/main.c
+++ b/trunk/src/or/main.c
@@ -569,7 +569,7 @@ directory_info_has_arrived(time_t now, int from_cache)
}
if (server_mode(options) && !we_are_hibernating() && !from_cache &&
- (has_completed_circuit || rep_hist_circbuilding_dormant(now)))
+ (has_completed_circuit || any_predicted_circuits(now)))
consider_testing_reachability();
}
@@ -833,7 +833,7 @@ run_scheduled_events(time_t now)
/* also, check religiously for reachability, if it's within the first
* 20 minutes of our uptime. */
if (server_mode(options) &&
- (has_completed_circuit || rep_hist_circbuilding_dormant(now)) &&
+ (has_completed_circuit || any_predicted_circuits(now)) &&
stats_n_seconds_working < TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT &&
!we_are_hibernating())
consider_testing_reachability();
diff --git a/trunk/src/or/or.h b/trunk/src/or/or.h
index 8e2d246b82..63869e6dd8 100644
--- a/trunk/src/or/or.h
+++ b/trunk/src/or/or.h
@@ -2141,6 +2141,7 @@ void rep_hist_note_used_internal(time_t now, int need_uptime,
int rep_hist_get_predicted_internal(time_t now, int *need_uptime,
int *need_capacity);
+int any_predicted_circuits(time_t now);
int rep_hist_circbuilding_dormant(time_t now);
void rep_hist_free_all(void);
diff --git a/trunk/src/or/rephist.c b/trunk/src/or/rephist.c
index 3d391ad94d..a9a16625c8 100644
--- a/trunk/src/or/rephist.c
+++ b/trunk/src/or/rephist.c
@@ -912,14 +912,20 @@ rep_hist_get_predicted_internal(time_t now, int *need_uptime,
return 1;
}
+/** Any ports used lately? These are pre-seeded if we just started
+ * up or if we're running a hidden service. */
+int
+any_predicted_circuits(time_t now)
+{
+ return smartlist_len(predicted_ports_list) ||
+ predicted_internal_time + PREDICTED_CIRCS_RELEVANCE_TIME >= now;
+}
+
/** Return 1 if we have no need for circuits currently, else return 0. */
int
rep_hist_circbuilding_dormant(time_t now)
{
- /* Any ports used lately? These are pre-seeded if we just started
- * up or if we're running a hidden service. */
- if (smartlist_len(predicted_ports_list) ||
- predicted_internal_time + PREDICTED_CIRCS_RELEVANCE_TIME >= now)
+ if (any_predicted_circuits(now))
return 0;
/* see if we'll still need to build testing circuits */