[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Make DirPostPeriod config option obsolete.



Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	config.c main.c router.c 
Log Message:
Make DirPostPeriod config option obsolete.
Force new descriptor upload every 18 hours, not 24, to avoid races.
Change rate-limiting on new descriptors due to bandwidth changes, from
45 minutes to 20 minutes.


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.394
retrieving revision 1.395
diff -u -d -r1.394 -r1.395
--- config.c	22 Aug 2005 06:45:18 -0000	1.394
+++ config.c	22 Aug 2005 21:53:12 -0000	1.395
@@ -115,7 +115,7 @@
   VAR("DirFetchPeriod",      INTERVAL, DirFetchPeriod,       "0 seconds"),  /** DOCDOC **/
   VAR("DirPolicy",           LINELIST, DirPolicy,            NULL),
   VAR("DirPort",             UINT,     DirPort,              "0"),
-  VAR("DirPostPeriod",       INTERVAL, DirPostPeriod,        "20 minutes"),
+  OBSOLETE("DirPostPeriod"),
   VAR("DirServer",           LINELIST, DirServers,           NULL),
   VAR("EntryNodes",          STRING,   EntryNodes,           NULL),
   VAR("ExcludeNodes",        STRING,   ExcludeNodes,         NULL),
@@ -1728,7 +1728,6 @@
   }
 
 #define MIN_DIR_FETCH_PERIOD 600
-#define MIN_DIR_POST_PERIOD 300
 #define MIN_REND_POST_PERIOD 300
 #define MIN_STATUS_FETCH_PERIOD 60
 
@@ -1746,11 +1745,6 @@
     log(LOG_WARN, "StatusFetchPeriod option must be at least %d seconds. Clipping.", MIN_STATUS_FETCH_PERIOD);
     options->StatusFetchPeriod = MIN_STATUS_FETCH_PERIOD;
   }
-  if (options->DirPostPeriod < MIN_DIR_POST_PERIOD) {
-    log(LOG_WARN, "DirPostPeriod option must be at least %d seconds. Clipping.",
-        MIN_DIR_POST_PERIOD);
-    options->DirPostPeriod = MIN_DIR_POST_PERIOD;
-  }
   if (options->RendPostPeriod < MIN_REND_POST_PERIOD) {
     log(LOG_WARN,"RendPostPeriod option must be at least %d seconds. Clipping.",
         MIN_REND_POST_PERIOD);
@@ -1772,10 +1766,6 @@
     log(LOG_WARN, "DirFetchPeriod is too large; clipping to %ds.", MAX_DIR_PERIOD);
     options->DirFetchPeriod = MAX_DIR_PERIOD;
   }
-  if (options->DirPostPeriod > MAX_DIR_PERIOD) {
-    log(LOG_WARN, "DirPostPeriod is too large; clipping to %ds.", MAX_DIR_PERIOD);
-    options->DirPostPeriod = MAX_DIR_PERIOD;
-  }
   if (options->StatusFetchPeriod > MAX_DIR_PERIOD) {
     log(LOG_WARN, "StatusFetchPeriod is too large; clipping to %ds.", MAX_DIR_PERIOD);
     options->StatusFetchPeriod = MAX_DIR_PERIOD;

Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.537
retrieving revision 1.538
diff -u -d -r1.537 -r1.538
--- main.c	22 Aug 2005 05:33:49 -0000	1.537
+++ main.c	22 Aug 2005 21:53:12 -0000	1.538
@@ -46,8 +46,6 @@
 long stats_n_seconds_working = 0;
 /** When do we next download a directory? */
 static time_t time_to_fetch_directory = 0;
-/** When do we next upload our descriptor? */
-static time_t time_to_force_upload_descriptor = 0;
 /** When do we next download a running-routers summary? */
 static time_t time_to_fetch_running_routers = 0;
 
@@ -94,7 +92,7 @@
 #define nt_service_is_stopped() (0)
 #endif
 
-#define FORCE_REGENERATE_DESCRIPTOR_INTERVAL 24*60*60 /* 1 day. */
+#define FORCE_REGENERATE_DESCRIPTOR_INTERVAL 18*60*60 /* 18 hours */
 #define CHECK_DESCRIPTOR_INTERVAL 60 /* one minute */
 #define BUF_SHRINK_INTERVAL 60 /* one minute */
 #define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60) /* 20 minutes */
@@ -545,9 +543,6 @@
   if (!time_to_fetch_directory)
     time_to_fetch_directory = now + get_dir_fetch_period(options);
 
-  if (!time_to_force_upload_descriptor)
-    time_to_force_upload_descriptor = now + options->DirPostPeriod;
-
   if (!time_to_fetch_running_routers)
     time_to_fetch_running_routers = now + get_status_fetch_period(options);
 
@@ -709,8 +704,10 @@
       time_to_fetch_running_routers = next_status_fetch;
     }
 
-    /* Also, take this chance to remove old information from rephist. */
+    /* Also, take this chance to remove old information from rephist
+     * and the rend cache. */
     rep_history_clean(now - options->RephistTrackTime);
+    rend_cache_clean();
   }
 
   if (time_to_fetch_running_routers < now) {
@@ -720,12 +717,6 @@
     time_to_fetch_running_routers = now + get_status_fetch_period(options);
   }
 
-  if (time_to_force_upload_descriptor < now) {
-    /*XXXX this should go elsewhere. */
-    rend_cache_clean(); /* this should go elsewhere? */
-    time_to_force_upload_descriptor = now + options->DirPostPeriod;
-  }
-
   /* 2b. Once per minute, regenerate and upload the descriptor if the old
    * one is inaccurate. */
   if (time_to_check_descriptor < now) {

Index: router.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/router.c,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -d -r1.187 -r1.188
--- router.c	22 Aug 2005 03:10:53 -0000	1.187
+++ router.c	22 Aug 2005 21:53:12 -0000	1.188
@@ -792,7 +792,7 @@
   desc_clean_since = 0;
 }
 
-#define MAX_BANDWIDTH_CHANGE_FREQ 45*60
+#define MAX_BANDWIDTH_CHANGE_FREQ 20*60
 /** Check whether bandwidth has changed a lot since the last time we announced
  * bandwidth.  If so, mark our descriptor dirty.*/
 void