[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r13176: If we've gone 12 hours since our last bandwidth check, and w (in tor/trunk: . doc src/or)
Author: arma
Date: 2008-01-17 23:58:40 -0500 (Thu, 17 Jan 2008)
New Revision: 13176
Modified:
tor/trunk/ChangeLog
tor/trunk/doc/TODO
tor/trunk/src/or/main.c
Log:
If we've gone 12 hours since our last bandwidth check, and we
estimate we have less than 50KB bandwidth capacity but we could
handle more, do another bandwidth test.
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2008-01-18 04:51:12 UTC (rev 13175)
+++ tor/trunk/ChangeLog 2008-01-18 04:58:40 UTC (rev 13176)
@@ -3,6 +3,9 @@
- Avoid going directly to the directory authorities even if you're a
relay, if you haven't found yourself reachable yet or if you've
decided not to advertise your dirport yet. Addresses bug 556.
+ - If we've gone 12 hours since our last bandwidth check, and we
+ estimate we have less than 50KB bandwidth capacity but we could
+ handle more, do another bandwidth test.
o Minor features:
- Don't answer "/tor/networkstatus-bridges" directory requests if
Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO 2008-01-18 04:51:12 UTC (rev 13175)
+++ tor/trunk/doc/TODO 2008-01-18 04:58:40 UTC (rev 13176)
@@ -93,7 +93,7 @@
even when the network came back and arma clicked on things.
also 0.2.0.
R - for above two, roger should turn them into flyspray entry.
-R - we should do another bandwidth test every 12 hours or something
+ o we should do another bandwidth test every 12 hours or something
if we're showing less than 50KB and our bandwidthrate says we can
do more than that. I think some servers are forgetting the results
of their first test, and then never seeing use.
Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c 2008-01-18 04:51:12 UTC (rev 13175)
+++ tor/trunk/src/or/main.c 2008-01-18 04:58:40 UTC (rev 13176)
@@ -837,6 +837,7 @@
static time_t time_to_save_stability = 0;
#define CLEAN_CACHES_INTERVAL (30*60)
static time_t time_to_clean_caches = 0;
+ static time_t time_to_recheck_bandwidth = 0;
or_options_t *options = get_options();
int i;
int have_dir_info;
@@ -1003,11 +1004,24 @@
* 20 minutes of our uptime. */
if (server_mode(options) &&
(has_completed_circuit || !any_predicted_circuits(now)) &&
- stats_n_seconds_working < TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT &&
!we_are_hibernating()) {
- consider_testing_reachability(1, dirport_reachability_count==0);
- if (++dirport_reachability_count > 5)
- dirport_reachability_count = 0;
+ if (stats_n_seconds_working < TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT) {
+ consider_testing_reachability(1, dirport_reachability_count==0);
+ if (++dirport_reachability_count > 5)
+ dirport_reachability_count = 0;
+ } else if (time_to_recheck_bandwidth < now) {
+ /* If we haven't checked for 12 hours and our bandwidth estimate is
+ * low, do another bandwidth test. This is especially important for
+ * bridges, since they might go long periods without much use. */
+ routerinfo_t *me = router_get_my_routerinfo();
+ if (time_to_recheck_bandwidth && me &&
+ me->bandwidthcapacity < me->bandwidthrate &&
+ me->bandwidthcapacity < 51200) {
+ reset_bandwidth_test();
+ }
+#define BANDWIDTH_RECHECK_INTERVAL (12*60*60)
+ time_to_recheck_bandwidth = now + BANDWIDTH_RECHECK_INTERVAL;
+ }
}
/* If any networkstatus documents are no longer recent, we need to