[or-cvs] r9690: - Stop calling servers that have been hibernating for a long (in tor/trunk: . src/or)
arma at seul.org
arma at seul.org
Wed Feb 28 21:06:09 UTC 2007
Author: arma
Date: 2007-02-28 16:06:05 -0500 (Wed, 28 Feb 2007)
New Revision: 9690
Modified:
tor/trunk/ChangeLog
tor/trunk/src/or/dirserv.c
Log:
- Stop calling servers that have been hibernating for a long time
"stable". Also, stop letting hibernating or obsolete servers affect
uptime and bandwidth cutoffs.
- Stop listing hibernating servers in the v1 directory.
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2007-02-28 20:49:09 UTC (rev 9689)
+++ tor/trunk/ChangeLog 2007-02-28 21:06:05 UTC (rev 9690)
@@ -7,6 +7,12 @@
- Do not rotate onion key immediately after setting it for the first
time.
+ o Minor bugfixes (directory servers):
+ - Stop calling servers that have been hibernating for a long time
+ "stable". Also, stop letting hibernating or obsolete servers affect
+ uptime and bandwidth cutoffs.
+ - Stop listing hibernating servers in the v1 directory.
+
o Minor bugfixes (other):
- Fix an assert that could trigger if a controller quickly set then
cleared EntryNodes. (Bug found by Udo van den Heuvel.)
Modified: tor/trunk/src/or/dirserv.c
===================================================================
--- tor/trunk/src/or/dirserv.c 2007-02-28 20:49:09 UTC (rev 9689)
+++ tor/trunk/src/or/dirserv.c 2007-02-28 21:06:05 UTC (rev 9690)
@@ -822,16 +822,16 @@
return result;
}
-/** Return 1 if <b>ri</b>'s descriptor is worth including in the v1
- * directory, else return 0.
+/** Return 1 if <b>ri</b>'s descriptor is "active" -- running, valid,
+ * not hibernating, and not too old. Else return 0.
*/
static int
-live_enough_for_v1_dir(routerinfo_t *ri, time_t now)
+router_is_active(routerinfo_t *ri, time_t now)
{
time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
if (ri->cache_info.published_on < cutoff)
return 0;
- if (!ri->is_running || !ri->is_valid)
+ if (!ri->is_running || !ri->is_valid || ri->is_hibernating)
return 0;
return 1;
}
@@ -878,7 +878,7 @@
buf_len = 2048+strlen(recommended_versions)+
strlen(router_status);
SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri,
- if (complete || live_enough_for_v1_dir(ri, now))
+ if (complete || router_is_active(ri, now))
buf_len += ri->cache_info.signed_descriptor_len+1);
buf = tor_malloc(buf_len);
/* We'll be comparing against buf_len throughout the rest of the
@@ -904,7 +904,7 @@
{
size_t len = ri->cache_info.signed_descriptor_len;
const char *body;
- if (!complete && !live_enough_for_v1_dir(ri, now))
+ if (!complete && !router_is_active(ri, now))
continue;
if (cp+len+1 >= buf+buf_len)
goto truncated;
@@ -1441,7 +1441,7 @@
bandwidths_excluding_exits = smartlist_create();
SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri, {
- if (ri->is_running && ri->is_valid) {
+ if (router_is_active(ri, now)) {
uint32_t *up = tor_malloc(sizeof(uint32_t));
uint32_t *bw = tor_malloc(sizeof(uint32_t));
ri->is_exit = exit_policy_is_general_exit(ri->exit_policy);
@@ -1968,6 +1968,7 @@
dirserv_test_reachability(int try_all)
{
time_t now = time(NULL);
+// time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
routerlist_t *rl = router_get_routerlist();
static char ctr = 0;
@@ -1975,6 +1976,8 @@
const char *id_digest = router->cache_info.identity_digest;
if (router_is_me(router))
continue;
+// if (router->cache_info.published_on > cutoff)
+// continue;
if (try_all || (((uint8_t)id_digest[0]) % 128) == ctr) {
log_debug(LD_OR,"Testing reachability of %s at %s:%u.",
router->nickname, router->address, router->or_port);
More information about the tor-commits
mailing list