[or-cvs] r13258: shrink it even more. coding is fun! (tor/trunk/src/or)

arma at seul.org arma at seul.org
Thu Jan 24 07:33:28 UTC 2008


Author: arma
Date: 2008-01-24 02:33:28 -0500 (Thu, 24 Jan 2008)
New Revision: 13258

Modified:
   tor/trunk/src/or/directory.c
Log:
shrink it even more. coding is fun!


Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2008-01-24 07:22:59 UTC (rev 13257)
+++ tor/trunk/src/or/directory.c	2008-01-24 07:33:28 UTC (rev 13258)
@@ -3315,20 +3315,15 @@
   tor_assert(desc_id);
   tor_assert(query);
   tor_assert(strlen(query) == REND_SERVICE_ID_LEN_BASE32);
-  /* Determine responsible dirs. */
-  if (hid_serv_get_responsible_directories(responsible_dirs, desc_id) < 0) {
-    /* XXX020 make this louder once we have some v2hidservs */
-    log_info(LD_REND, "Could not determine the responsible hidden service "
-                      "directories to fetch descriptors.");
-    smartlist_free(responsible_dirs);
-    return -1;
-  }
+  /* Determine responsible dirs. Even if we can't get all we want,
+   * work with the ones we have. If it's empty, we'll notice below. */
+  (int) hid_serv_get_responsible_directories(responsible_dirs, desc_id);
 
   base32_encode(desc_id_base32, sizeof(desc_id_base32),
                 desc_id, DIGEST_LEN);
 
   /* Only select those hidden service directories to which we did not send
-   * a request earlier. */
+   * a request recently. */
   directory_clean_last_hid_serv_requests(); /* Clean request history first. */
 
   SMARTLIST_FOREACH(responsible_dirs, routerstatus_t *, dir, {
@@ -3337,20 +3332,14 @@
       SMARTLIST_DEL_CURRENT(responsible_dirs, dir);
   });
 
-  if (smartlist_len(responsible_dirs) == 0) {
+  hs_dir = smartlist_choose(responsible_dirs);
+  smartlist_free(responsible_dirs);
+  if (!hs_dir) {
     log_info(LD_REND, "Could not pick one of the responsible hidden "
                       "service directories, because we requested them all "
                       "recently without success.");
-    smartlist_free(responsible_dirs);
     return 0;
   }
-  hs_dir = smartlist_choose(responsible_dirs);
-  smartlist_free(responsible_dirs);
-  if (!hs_dir) {
-    log_warn(LD_BUG, "Could not pick one of the responsible hidden service "
-                     "directories to fetch descriptors.");
-    return -1;
-  }
 
   /* Remember, that we are requesting a descriptor from this hidden service
    * directory now. */



More information about the tor-commits mailing list