[or-cvs] r11354: bug fixes having to do with v2 descriptor upload/download (tor/branches/114-dist-storage/src/or)

kloesing at seul.org kloesing at seul.org
Sun Sep 2 19:31:22 UTC 2007


Author: kloesing
Date: 2007-09-02 15:31:22 -0400 (Sun, 02 Sep 2007)
New Revision: 11354

Modified:
   tor/branches/114-dist-storage/src/or/directory.c
   tor/branches/114-dist-storage/src/or/rendservice.c
   tor/branches/114-dist-storage/src/or/routerlist.c
Log:
bug fixes having to do with v2 descriptor upload/download

Modified: tor/branches/114-dist-storage/src/or/directory.c
===================================================================
--- tor/branches/114-dist-storage/src/or/directory.c	2007-09-02 14:19:50 UTC (rev 11353)
+++ tor/branches/114-dist-storage/src/or/directory.c	2007-09-02 19:31:22 UTC (rev 11354)
@@ -2768,15 +2768,13 @@
     if (!pred_router) {
       log_warn(LD_REND, "Did not find combined status for router. "
                         "Skipping router for replication.");
-      i--;
-      continue;
+      return;
     }
     pred_status = &(pred_router->status);
     if (!pred_status) {
       log_warn(LD_REND, "Could not determine router status. "
                         "Skipping router for replication.");
-      i--;
-      continue;
+      return;
     }
     base32_encode(from_id_base32, REND_DESC_ID_V2_LEN + 1, predecessor1,
                   DIGEST_LEN);
@@ -2798,13 +2796,13 @@
     if (!succ_router) {
       log_warn(LD_REND, "Did not find combined status for router. "
                         "Skipping router for replication.");
-      continue;
+      return;
     }
     succ_status = &(succ_router->status);
     if (!succ_status) {
       log_warn(LD_REND, "Could not determine router status. "
                         "Skipping router for replication.");
-      continue;
+      return;
     }
     base32_encode(from_id_base32, REND_DESC_ID_V2_LEN + 1,
                   direct_predecessor, DIGEST_LEN);

Modified: tor/branches/114-dist-storage/src/or/rendservice.c
===================================================================
--- tor/branches/114-dist-storage/src/or/rendservice.c	2007-09-02 14:19:50 UTC (rev 11353)
+++ tor/branches/114-dist-storage/src/or/rendservice.c	2007-09-02 19:31:22 UTC (rev 11354)
@@ -1051,6 +1051,12 @@
     }
     smartlist_free(desc_strs);
     smartlist_free(desc_ids);
+    /* Update next upload time. */
+    if (seconds_valid - TIME_PERIOD_TWO_V2_DESCS < rendpostperiod)
+      service->next_upload_time = now + seconds_valid -
+                                  TIME_PERIOD_TWO_V2_DESCS + 1;
+    else
+      service->next_upload_time = now + rendpostperiod;
     /* Post also the next descriptors, if necessary. */
     if (seconds_valid < TIME_PERIOD_TWO_V2_DESCS) {
       desc_strs = smartlist_create();
@@ -1059,21 +1065,16 @@
                                                  service->desc, now,
                                                  service->secret_cookie, 1);
       directory_post_to_hs_dir(desc_ids, desc_strs, serviceid, seconds_valid);
+      /* Free memory for descriptors. */
+      for (i = 0; i < NUMBER_OF_NON_CONSECUTIVE_REPLICAS; i++) {
+        tor_free(desc_strs->list[i]);
+        tor_free(desc_ids->list[i]);
+      }
+      smartlist_free(desc_strs);
+      smartlist_free(desc_ids);
     }
-    /* Free memory for descriptors. */
-    for (i = 0; i < NUMBER_OF_NON_CONSECUTIVE_REPLICAS; i++) {
-      tor_free(desc_strs->list[i]);
-      tor_free(desc_ids->list[i]);
-    }
-    smartlist_free(desc_strs);
-    smartlist_free(desc_ids);
-    /* Update next upload time. */
-    if (seconds_valid - TIME_PERIOD_TWO_V2_DESCS < rendpostperiod)
-      service->next_upload_time = now + seconds_valid -
-                                  TIME_PERIOD_TWO_V2_DESCS + 1;
-    else
-      service->next_upload_time = now + rendpostperiod;
     uploaded = 1;
+    log_info(LD_REND, "Successfully uploaded v2 rend descriptors!");
   }
 
   /* If not uploaded, try again in one minute. */

Modified: tor/branches/114-dist-storage/src/or/routerlist.c
===================================================================
--- tor/branches/114-dist-storage/src/or/routerlist.c	2007-09-02 14:19:50 UTC (rev 11353)
+++ tor/branches/114-dist-storage/src/or/routerlist.c	2007-09-02 19:31:22 UTC (rev 11354)
@@ -5598,6 +5598,8 @@
   char id_base32[32+1];
   base32_encode(id_base32, 32+1, id, 20);
   tor_assert(id);
+  /* To be sure, update routing table. */
+  update_hs_dir_routing_table();
   if (!have_enough_hs_dirs()) {
     log_warn(LD_REND, "We don't have enough hidden service directories to "
                       "perform v2 rendezvous operations!");
@@ -5610,15 +5612,13 @@
     if (!router) {
       log_warn(LD_REND, "Did not find combined status for router. "
                         "Skipping router.");
-      i--;
-      continue;
+      return -1;
     }
     status = &(router->status);
     if (!status) {
       log_warn(LD_REND, "Could not determine router status. "
                         "Skipping router.");
-      i--;
-      continue;
+      return -1;
     }
     smartlist_add(hs_dirs, status);
   }



More information about the tor-commits mailing list