[or-cvs] r11866: Remove code to generate v1 directories. (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Thu Oct 11 13:56:34 UTC 2007


Author: nickm
Date: 2007-10-11 09:56:33 -0400 (Thu, 11 Oct 2007)
New Revision: 11866

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/dirserv.c
   tor/trunk/src/or/main.c
   tor/trunk/src/or/or.h
Log:
 r15679 at catbus:  nickm | 2007-10-11 09:51:33 -0400
 Remove code to generate v1 directories.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15679] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-10-11 03:30:15 UTC (rev 11865)
+++ tor/trunk/ChangeLog	2007-10-11 13:56:33 UTC (rev 11866)
@@ -114,6 +114,8 @@
       uniform.
     - Turn all 'Are we a directory server/mirror?' logic into a call to
       dirserver_mode().
+    - Remove the code to generate the oldest (v1) directory format.
+      The code has been disabled since 0.2.0.5-alpha.
 
 
 Changes in version 0.2.0.7-alpha - 2007-09-21

Modified: tor/trunk/src/or/dirserv.c
===================================================================
--- tor/trunk/src/or/dirserv.c	2007-10-11 03:30:15 UTC (rev 11865)
+++ tor/trunk/src/or/dirserv.c	2007-10-11 13:56:33 UTC (rev 11866)
@@ -789,9 +789,6 @@
   time_t now = time(NULL);
   int set_v1_dirty=0;
 
-#ifdef FULL_V1_DIRECTORIES
-  set_v1_dirty = 1;
-#else
   /* Regenerate stubs only every 8 hours. XXXX020 */
 #define STUB_REGENERATE_INTERVAL (8*60*60)
   if (!the_directory || !the_runningrouters.dir)
@@ -799,7 +796,6 @@
   else if (the_directory->published < now - STUB_REGENERATE_INTERVAL ||
            the_runningrouters.published < now - STUB_REGENERATE_INTERVAL)
     set_v1_dirty = 1;
-#endif
 
   if (set_v1_dirty) {
     if (!the_directory_is_dirty)
@@ -976,10 +972,9 @@
  */
 int
 dirserv_dump_directory_to_string(char **dir_out,
-                                 crypto_pk_env_t *private_key, int complete)
+                                 crypto_pk_env_t *private_key)
 {
   char *cp;
-  char *router_status;
   char *identity_pkey; /* Identity key, DER64-encoded. */
   char *recommended_versions;
   char digest[DIGEST_LEN];
@@ -988,22 +983,10 @@
   size_t buf_len;
   size_t identity_pkey_len;
   time_t now = time(NULL);
-#ifdef FULL_V1_DIRECTORIES
-  routerlist_t *rl = router_get_routerlist();
-#else
-  (void)complete;
-#endif
 
   tor_assert(dir_out);
   *dir_out = NULL;
 
-#ifdef FULL_V1_DIRECTORIES
-  if (list_server_status(rl->routers, &router_status, 0))
-    return -1;
-#else
-  router_status = tor_strdup("");
-#endif
-
   if (crypto_pk_write_public_key_to_string(private_key,&identity_pkey,
                                            &identity_pkey_len)<0) {
     log_warn(LD_BUG,"write identity_pkey to string failed!");
@@ -1015,13 +998,8 @@
 
   format_iso_time(published, now);
 
-  buf_len = 2048+strlen(recommended_versions)+
-    strlen(router_status);
-#ifdef FULL_V1_DIRECTORIES
-  SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri,
-                    if (complete || router_is_active(ri, now))
-                      buf_len += ri->cache_info.signed_descriptor_len+1);
-#endif
+  buf_len = 2048+strlen(recommended_versions);
+
   buf = tor_malloc(buf_len);
   /* We'll be comparing against buf_len throughout the rest of the
      function, though strictly speaking we shouldn't be able to exceed
@@ -1034,30 +1012,13 @@
                "recommended-software %s\n"
                "router-status %s\n"
                "dir-signing-key\n%s\n",
-               published, recommended_versions, router_status,
+               published, recommended_versions, "",
                identity_pkey);
 
   tor_free(recommended_versions);
-  tor_free(router_status);
   tor_free(identity_pkey);
 
   cp = buf + strlen(buf);
-#ifdef FULL_V1_DIRECTORIES
-  SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri,
-    {
-      size_t len = ri->cache_info.signed_descriptor_len;
-      const char *body;
-      if (!complete && !router_is_active(ri, now))
-        continue;
-      if (cp+len+1 >= buf+buf_len)
-        goto truncated;
-      body = signed_descriptor_get_body(&ri->cache_info);
-      memcpy(cp, body, len);
-      cp += len;
-      *cp++ = '\n'; /* add an extra newline in case somebody was depending on
-                     * it. */
-    });
-#endif
   *cp = '\0';
 
   /* These multiple strlcat calls are inefficient, but dwarfed by the RSA
@@ -1384,8 +1345,7 @@
 {
   char *new_directory=NULL;
 
-  if (dirserv_dump_directory_to_string(&new_directory,
-                                       get_identity_key(), 0)) {
+  if (dirserv_dump_directory_to_string(&new_directory, get_identity_key())) {
     log_warn(LD_BUG, "Error creating directory.");
     tor_free(new_directory);
     return NULL;
@@ -1412,24 +1372,13 @@
 generate_runningrouters(void)
 {
   char *s=NULL;
-  char *router_status=NULL;
   char digest[DIGEST_LEN];
   char published[ISO_TIME_LEN+1];
   size_t len;
   crypto_pk_env_t *private_key = get_identity_key();
   char *identity_pkey; /* Identity key, DER64-encoded. */
   size_t identity_pkey_len;
-#ifdef FULL_V1_DIRECTORIES
-  routerlist_t *rl = router_get_routerlist();
-#endif
 
-#ifdef FULL_V1_DIRECTORIES
-  if (list_server_status(rl->routers, &router_status, 0)) {
-    goto err;
-  }
-#else
-  router_status = tor_strdup("");
-#endif
   if (crypto_pk_write_public_key_to_string(private_key,&identity_pkey,
                                            &identity_pkey_len)<0) {
     log_warn(LD_BUG,"write identity_pkey to string failed!");
@@ -1437,7 +1386,7 @@
   }
   format_iso_time(published, time(NULL));
 
-  len = 2048+strlen(router_status);
+  len = 2048;
   s = tor_malloc_zero(len);
   tor_snprintf(s, len,
                "network-status\n"
@@ -1445,9 +1394,8 @@
                "router-status %s\n"
                "dir-signing-key\n%s"
                "directory-signature %s\n",
-               published, router_status, identity_pkey,
+               published, "", identity_pkey,
                get_options()->Nickname);
-  tor_free(router_status);
   tor_free(identity_pkey);
   if (router_get_runningrouters_hash(s,digest)) {
     log_warn(LD_BUG,"couldn't compute digest");
@@ -1463,7 +1411,6 @@
   return &the_runningrouters;
  err:
   tor_free(s);
-  tor_free(router_status);
   return NULL;
 }
 

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2007-10-11 03:30:15 UTC (rev 11865)
+++ tor/trunk/src/or/main.c	2007-10-11 13:56:33 UTC (rev 11866)
@@ -957,11 +957,7 @@
                                    ROUTER_PURPOSE_GENERAL, NULL, 1);
     }
 /** How often do we (as a cache) fetch a new V1 runningrouters document? */
-#ifdef FULL_V1_DIRECTORIES
-#define V1_RUNNINGROUTERS_FETCH_PERIOD (30*60)
-#else
 #define V1_RUNNINGROUTERS_FETCH_PERIOD (6*60*60)
-#endif
     time_to_fetch_running_routers = now + V1_RUNNINGROUTERS_FETCH_PERIOD;
 
      /* Also, take this chance to remove old information from rephist

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-10-11 03:30:15 UTC (rev 11865)
+++ tor/trunk/src/or/or.h	2007-10-11 13:56:33 UTC (rev 11866)
@@ -2842,8 +2842,7 @@
 int list_server_status(smartlist_t *routers, char **router_status_out,
                        int for_controller);
 int dirserv_dump_directory_to_string(char **dir_out,
-                                     crypto_pk_env_t *private_key,
-                                     int complete);
+                                     crypto_pk_env_t *private_key);
 void directory_set_dirty(void);
 cached_dir_t *dirserv_get_directory(void);
 cached_dir_t *dirserv_get_runningrouters(void);



More information about the tor-commits mailing list