summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-07-22 07:25:27 +0000
committerRoger Dingledine <arma@torproject.org>2006-07-22 07:25:27 +0000
commitfe5cf36bbbe21e68fa34f52978f29a12d5410083 (patch)
tree61a5121da1f2266a9766a6490c99d88cbfa47db8
parentc062248eba0491bbb6689e8e841d97e8f6859587 (diff)
downloadtor-fe5cf36bbbe21e68fa34f52978f29a12d5410083.tar.gz
tor-fe5cf36bbbe21e68fa34f52978f29a12d5410083.zip
and backport the other half of the reachability test, now that i'm
happy with it. svn:r6807
-rw-r--r--src/or/main.c5
-rw-r--r--src/or/or.h2
-rw-r--r--src/or/rephist.c9
3 files changed, 14 insertions, 2 deletions
diff --git a/src/or/main.c b/src/or/main.c
index a26d72418e..c897b0d0b3 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -601,7 +601,8 @@ directory_info_has_arrived(time_t now, int from_cache)
!we_are_hibernating()) { /* connect to the appropriate routers */
if (!authdir_mode(options))
router_retry_connections(0, 1);
- if (!from_cache && has_completed_circuit)
+ if (!from_cache &&
+ (has_completed_circuit || !any_predicted_circuits(now)))
consider_testing_reachability();
}
}
@@ -864,7 +865,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 &&
+ (has_completed_circuit || !any_predicted_circuits(now)) &&
stats_n_seconds_working < TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT &&
!we_are_hibernating())
consider_testing_reachability();
diff --git a/src/or/or.h b/src/or/or.h
index 286f7a0998..20e18e55df 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2121,6 +2121,8 @@ int rep_hist_get_predicted_internal(time_t now, int *need_uptime,
void rep_hist_update_state(or_state_t *state);
int rep_hist_load_state(or_state_t *state, char **err);
+int any_predicted_circuits(time_t now);
+
void rep_hist_free_all(void);
/********************************* rendclient.c ***************************/
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 0790084597..8caad25ce4 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -912,6 +912,15 @@ 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;
+}
+
/** Free all storage held by the OR/link history caches, by the
* bandwidth history arrays, or by the port history. */
void