[or-cvs] and backport the other half of the reachability test, now t...
arma at seul.org
arma at seul.org
Sat Jul 22 07:25:30 UTC 2006
Update of /home/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/tor-011x/tor/src/or
Modified Files:
Tag: tor-0_1_1-patches
main.c or.h rephist.c
Log Message:
and backport the other half of the reachability test, now that i'm
happy with it.
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.639.2.3
retrieving revision 1.639.2.4
diff -u -p -d -r1.639.2.3 -r1.639.2.4
--- main.c 21 Jul 2006 07:55:56 -0000 1.639.2.3
+++ main.c 22 Jul 2006 07:25:27 -0000 1.639.2.4
@@ -601,7 +601,8 @@ directory_info_has_arrived(time_t now, i
!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();
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.824.2.6
retrieving revision 1.824.2.7
diff -u -p -d -r1.824.2.6 -r1.824.2.7
--- or.h 10 Jun 2006 00:32:31 -0000 1.824.2.6
+++ or.h 22 Jul 2006 07:25:27 -0000 1.824.2.7
@@ -2121,6 +2121,8 @@ int rep_hist_get_predicted_internal(time
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 ***************************/
Index: rephist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rephist.c,v
retrieving revision 1.84.2.1
retrieving revision 1.84.2.2
diff -u -p -d -r1.84.2.1 -r1.84.2.2
--- rephist.c 18 Apr 2006 03:05:34 -0000 1.84.2.1
+++ rephist.c 22 Jul 2006 07:25:27 -0000 1.84.2.2
@@ -912,6 +912,15 @@ rep_hist_get_predicted_internal(time_t n
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
More information about the tor-commits
mailing list