mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 13:53:31 +01:00
- 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. svn:r9690
This commit is contained in:
parent
9fd669c339
commit
b78f67dbf5
@ -7,6 +7,12 @@ Changes in version 0.1.2.9-??? - 2007-??-??
|
|||||||
- Do not rotate onion key immediately after setting it for the first
|
- Do not rotate onion key immediately after setting it for the first
|
||||||
time.
|
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):
|
o Minor bugfixes (other):
|
||||||
- Fix an assert that could trigger if a controller quickly set then
|
- Fix an assert that could trigger if a controller quickly set then
|
||||||
cleared EntryNodes. (Bug found by Udo van den Heuvel.)
|
cleared EntryNodes. (Bug found by Udo van den Heuvel.)
|
||||||
|
@ -822,16 +822,16 @@ format_versions_list(config_line_t *ln)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return 1 if <b>ri</b>'s descriptor is worth including in the v1
|
/** Return 1 if <b>ri</b>'s descriptor is "active" -- running, valid,
|
||||||
* directory, else return 0.
|
* not hibernating, and not too old. Else return 0.
|
||||||
*/
|
*/
|
||||||
static int
|
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;
|
time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
|
||||||
if (ri->cache_info.published_on < cutoff)
|
if (ri->cache_info.published_on < cutoff)
|
||||||
return 0;
|
return 0;
|
||||||
if (!ri->is_running || !ri->is_valid)
|
if (!ri->is_running || !ri->is_valid || ri->is_hibernating)
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -878,7 +878,7 @@ dirserv_dump_directory_to_string(char **dir_out,
|
|||||||
buf_len = 2048+strlen(recommended_versions)+
|
buf_len = 2048+strlen(recommended_versions)+
|
||||||
strlen(router_status);
|
strlen(router_status);
|
||||||
SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri,
|
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_len += ri->cache_info.signed_descriptor_len+1);
|
||||||
buf = tor_malloc(buf_len);
|
buf = tor_malloc(buf_len);
|
||||||
/* We'll be comparing against buf_len throughout the rest of the
|
/* We'll be comparing against buf_len throughout the rest of the
|
||||||
@ -904,7 +904,7 @@ dirserv_dump_directory_to_string(char **dir_out,
|
|||||||
{
|
{
|
||||||
size_t len = ri->cache_info.signed_descriptor_len;
|
size_t len = ri->cache_info.signed_descriptor_len;
|
||||||
const char *body;
|
const char *body;
|
||||||
if (!complete && !live_enough_for_v1_dir(ri, now))
|
if (!complete && !router_is_active(ri, now))
|
||||||
continue;
|
continue;
|
||||||
if (cp+len+1 >= buf+buf_len)
|
if (cp+len+1 >= buf+buf_len)
|
||||||
goto truncated;
|
goto truncated;
|
||||||
@ -1441,7 +1441,7 @@ dirserv_compute_performance_thresholds(routerlist_t *rl)
|
|||||||
bandwidths_excluding_exits = smartlist_create();
|
bandwidths_excluding_exits = smartlist_create();
|
||||||
|
|
||||||
SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri, {
|
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 *up = tor_malloc(sizeof(uint32_t));
|
||||||
uint32_t *bw = tor_malloc(sizeof(uint32_t));
|
uint32_t *bw = tor_malloc(sizeof(uint32_t));
|
||||||
ri->is_exit = exit_policy_is_general_exit(ri->exit_policy);
|
ri->is_exit = exit_policy_is_general_exit(ri->exit_policy);
|
||||||
@ -1968,6 +1968,7 @@ void
|
|||||||
dirserv_test_reachability(int try_all)
|
dirserv_test_reachability(int try_all)
|
||||||
{
|
{
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
// time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
|
||||||
routerlist_t *rl = router_get_routerlist();
|
routerlist_t *rl = router_get_routerlist();
|
||||||
static char ctr = 0;
|
static char ctr = 0;
|
||||||
|
|
||||||
@ -1975,6 +1976,8 @@ dirserv_test_reachability(int try_all)
|
|||||||
const char *id_digest = router->cache_info.identity_digest;
|
const char *id_digest = router->cache_info.identity_digest;
|
||||||
if (router_is_me(router))
|
if (router_is_me(router))
|
||||||
continue;
|
continue;
|
||||||
|
// if (router->cache_info.published_on > cutoff)
|
||||||
|
// continue;
|
||||||
if (try_all || (((uint8_t)id_digest[0]) % 128) == ctr) {
|
if (try_all || (((uint8_t)id_digest[0]) % 128) == ctr) {
|
||||||
log_debug(LD_OR,"Testing reachability of %s at %s:%u.",
|
log_debug(LD_OR,"Testing reachability of %s at %s:%u.",
|
||||||
router->nickname, router->address, router->or_port);
|
router->nickname, router->address, router->or_port);
|
||||||
|
Loading…
Reference in New Issue
Block a user