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.


svn:r13176
This commit is contained in:
Roger Dingledine
2008-01-18 04:58:40 +00:00
parent 3d3663a123
commit 43dce232ad
3 changed files with 22 additions and 5 deletions
+3
View File
@@ -3,6 +3,9 @@ Changes in version 0.2.0.18-alpha - 2008-01-??
- 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
+1 -1
View File
@@ -93,7 +93,7 @@ N - Before the feature freeze:
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.
+18 -4
View File
@@ -837,6 +837,7 @@ run_scheduled_events(time_t now)
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 @@ run_scheduled_events(time_t now)
* 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