diff --git a/doc/TODO b/doc/TODO index cb4e4cc765..5bd7dae112 100644 --- a/doc/TODO +++ b/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. diff --git a/src/or/main.c b/src/or/main.c index 4fc01c1818..cf6533db11 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -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