[or-cvs] Fetch running-routers.

Nick Mathewson nickm at seul.org
Sun Nov 14 21:46:42 UTC 2004


Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv16123/src/or

Modified Files:
	main.c 
Log Message:
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.


Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.372
retrieving revision 1.373
diff -u -d -r1.372 -r1.373
--- main.c	14 Nov 2004 13:35:47 -0000	1.372
+++ main.c	14 Nov 2004 21:46:40 -0000	1.373
@@ -376,7 +376,8 @@
    * 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 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 @@
    *    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 @@
     }
 
     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



More information about the tor-commits mailing list