mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Fetch running-routers.
Split logic to initiate dirfetch, running-routers fetch, and descriptor post. arma: There are some XXXs here that raise design questions which we should solve before the next release. The biggest problem is this: Right now, the directory is about 50X as large as running-routers uncompressed, and about 36X as large compressed. Assuming: - everybody gets the compressed version of everything, - everybody gets cached directories from random dirservers and uncached r-r from authdirservers - everybody downloads r-r at the same rate they now download dirs, then using r-r from will *increase* authdirserver directory bandwidth usage if there are significantly more caches than authdirservers. I think it's safe to leave this in for now, since there aren't 3x36 caching dirservers, but we should make everybody with a dirport cache running-routers soon. But I could be wrong. svn:r2872
This commit is contained in:
parent
2078b136f6
commit
57536f138a
6
doc/TODO
6
doc/TODO
@ -24,7 +24,11 @@ N - clients now have certs, which means we warn when their certs have
|
||||
o Function to generate the contents for a torrc file.
|
||||
o Function to safely replace a torrc file.
|
||||
R - fix print_usage()
|
||||
- Download and use running-routers
|
||||
. Download and use running-routers
|
||||
o Code to download running-routers
|
||||
- Decouple DirFetchPeriod, StatusFetchPeriod, DirPostPeriod.
|
||||
- Do we really want to send the clients to the authdirservers for
|
||||
running-routers so often?
|
||||
R - document signals in man page
|
||||
o Check for hibernation on startup, hup, etc.
|
||||
N - Test hibernation a lot.
|
||||
|
@ -376,7 +376,8 @@ void directory_has_arrived(time_t now) {
|
||||
* seconds after the directory we had when we started.
|
||||
*/
|
||||
if (!time_to_fetch_directory)
|
||||
time_to_fetch_directory = now + options->DirFetchPostPeriod;
|
||||
/*XXX *5 is unreasonable. We should have separate options for these cases.*/
|
||||
time_to_fetch_directory = now + options->DirFetchPostPeriod*5;
|
||||
|
||||
if (server_mode(options) &&
|
||||
!we_are_hibernating()) { /* connect to the appropriate routers */
|
||||
@ -512,6 +513,8 @@ static void run_scheduled_events(time_t now) {
|
||||
static time_t last_rotated_certificate = 0;
|
||||
static time_t time_to_check_listeners = 0;
|
||||
static time_t time_to_check_descriptor = 0;
|
||||
static time_t time_to_force_upload_descriptor = 0;
|
||||
static time_t time_to_fetch_running_routers = 0;
|
||||
or_options_t *options = get_options();
|
||||
int i;
|
||||
|
||||
@ -560,14 +563,6 @@ static void run_scheduled_events(time_t now) {
|
||||
* force-upload our descriptor (if we've passed our internal
|
||||
* checks). */
|
||||
if(time_to_fetch_directory < now) {
|
||||
if(decide_if_publishable_server(now)) {
|
||||
server_is_advertised = 1;
|
||||
router_rebuild_descriptor(1);
|
||||
router_upload_dir_desc_to_dirservers(1);
|
||||
} else {
|
||||
server_is_advertised = 0;
|
||||
}
|
||||
|
||||
/* purge obsolete entries */
|
||||
routerlist_remove_old_routers(ROUTER_MAX_AGE);
|
||||
|
||||
@ -582,15 +577,37 @@ static void run_scheduled_events(time_t now) {
|
||||
}
|
||||
|
||||
directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL);
|
||||
/*XXX *5 is unreasonable. We should have separate options for these cases.*/
|
||||
time_to_fetch_directory = now + options->DirFetchPostPeriod*5;
|
||||
time_to_fetch_running_routers = now + options->DirFetchPostPeriod;
|
||||
}
|
||||
|
||||
if (time_to_fetch_running_routers < now) {
|
||||
if (!authdir_mode(options)) {
|
||||
directory_get_from_dirserver(DIR_PURPOSE_FETCH_RUNNING_LIST, NULL);
|
||||
}
|
||||
time_to_fetch_running_routers = now + options->DirFetchPostPeriod;
|
||||
}
|
||||
|
||||
if (time_to_force_upload_descriptor < now) {
|
||||
/*XXX Separate option for this, too. */
|
||||
time_to_force_upload_descriptor = now + options->DirFetchPostPeriod;
|
||||
if(decide_if_publishable_server(now)) {
|
||||
server_is_advertised = 1;
|
||||
router_rebuild_descriptor(1);
|
||||
router_upload_dir_desc_to_dirservers(1);
|
||||
} else {
|
||||
server_is_advertised = 0;
|
||||
}
|
||||
|
||||
if(!we_are_hibernating()) {
|
||||
/* Force an upload of our rend descriptors every DirFetchPostPeriod seconds. */
|
||||
rend_services_upload(1);
|
||||
last_uploaded_services = now;
|
||||
}
|
||||
rend_cache_clean(); /* should this go elsewhere? */
|
||||
rend_cache_clean(); /* this should go elsewhere? */
|
||||
|
||||
time_to_fetch_directory = now + options->DirFetchPostPeriod;
|
||||
time_to_force_upload_descriptor = now + options->DirFetchPostPeriod;
|
||||
}
|
||||
|
||||
/* 2b. Once per minute, regenerate and upload the descriptor if the old
|
||||
|
Loading…
Reference in New Issue
Block a user