[or-cvs] ORs post descriptors periodically too

Roger Dingledine arma at seul.org
Tue Sep 30 23:06:25 UTC 2003


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

Modified Files:
	config.c main.c or.h 
Log Message:
ORs post descriptors periodically too


Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- config.c	29 Sep 2003 07:50:08 -0000	1.48
+++ config.c	30 Sep 2003 23:06:23 -0000	1.49
@@ -161,7 +161,7 @@
     config_compare(list, "APPort",          CONFIG_TYPE_INT, &options->APPort) ||
     config_compare(list, "ORPort",          CONFIG_TYPE_INT, &options->ORPort) ||
     config_compare(list, "DirPort",         CONFIG_TYPE_INT, &options->DirPort) ||
-    config_compare(list, "DirFetchPeriod",  CONFIG_TYPE_INT, &options->DirFetchPeriod) ||
+    config_compare(list, "DirFetchPostPeriod",CONFIG_TYPE_INT, &options->DirFetchPostPeriod) ||
     config_compare(list, "KeepalivePeriod", CONFIG_TYPE_INT, &options->KeepalivePeriod) ||
     config_compare(list, "MaxOnionsPending",CONFIG_TYPE_INT, &options->MaxOnionsPending) ||
     config_compare(list, "NewCircuitPeriod",CONFIG_TYPE_INT, &options->NewCircuitPeriod) ||
@@ -202,7 +202,7 @@
   options->DataDirectory = NULL;
   options->CoinWeight = 0.8;
   options->MaxConn = 900;
-  options->DirFetchPeriod = 600;
+  options->DirFetchPostPeriod = 600;
   options->KeepalivePeriod = 300;
   options->MaxOnionsPending = 10;
   options->NewCircuitPeriod = 60; /* once a minute */
@@ -306,8 +306,8 @@
     result = -1;
   }
 
-  if(options->DirFetchPeriod < 1) {
-    log(LOG_WARNING,"DirFetchPeriod option must be positive.");
+  if(options->DirFetchPostPeriod < 1) {
+    log(LOG_WARNING,"DirFetchPostPeriod option must be positive.");
     result = -1;
   }
 

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- main.c	30 Sep 2003 22:44:33 -0000	1.117
+++ main.c	30 Sep 2003 23:06:23 -0000	1.118
@@ -276,16 +276,22 @@
 
   if(now.tv_sec > current_second) { /* the second has rolled over. check more stuff. */
 
-    if(!options.DirPort) {
-      if(time_to_fetch_directory < now.tv_sec) {
-        /* it's time to fetch a new directory */
+    if(time_to_fetch_directory < now.tv_sec) {
+      /* it's time to fetch a new directory and/or post our descriptor */
+      if(options.OnionRouter) {
+        if (init_descriptor()<0) {
+          log_fn(LOG_WARNING, "Error initializing descriptor. Not uploading desc.");
+        } else {
+          router_upload_desc_to_dirservers();
+        }
+      }
+      if(!options.DirPort) {
         /* NOTE directory servers do not currently fetch directories.
-         * Hope this doesn't bite us later.
-         */
+         * Hope this doesn't bite us later. */
         directory_initiate_command(router_pick_directory_server(),
                                    DIR_CONN_STATE_CONNECTING_FETCH);
-        time_to_fetch_directory = now.tv_sec + options.DirFetchPeriod;
       }
+      time_to_fetch_directory = now.tv_sec + options.DirFetchPostPeriod;
     }
 
     if(options.APPort && time_to_new_circuit < now.tv_sec) {
@@ -705,7 +711,7 @@
   int result=0;
   struct exit_policy_t *tmpe;
   
-  get_platform_str(platform, 256);
+  get_platform_str(platform, sizeof(platform));
 
   if(crypto_pk_write_public_key_to_string(router->onion_pkey,
                                           &onion_pkey,&onion_pkeylen)<0) {

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- or.h	30 Sep 2003 21:27:16 -0000	1.149
+++ or.h	30 Sep 2003 23:06:23 -0000	1.150
@@ -430,7 +430,7 @@
    int LinkPadding;
    int IgnoreVersion;
    int DirRebuildPeriod;
-   int DirFetchPeriod;
+   int DirFetchPostPeriod;
    int KeepalivePeriod;
    int MaxOnionsPending;
    int NewCircuitPeriod;



More information about the tor-commits mailing list