[or-cvs] r12826: cleanups on r12825 (in tor/trunk: doc/spec src/or)

arma at seul.org arma at seul.org
Sat Dec 15 20:50:56 UTC 2007


Author: arma
Date: 2007-12-15 15:50:56 -0500 (Sat, 15 Dec 2007)
New Revision: 12826

Modified:
   tor/trunk/doc/spec/rend-spec.txt
   tor/trunk/src/or/directory.c
   tor/trunk/src/or/rendcommon.c
   tor/trunk/src/or/rendservice.c
Log:
cleanups on r12825


Modified: tor/trunk/doc/spec/rend-spec.txt
===================================================================
--- tor/trunk/doc/spec/rend-spec.txt	2007-12-15 20:28:09 UTC (rev 12825)
+++ tor/trunk/doc/spec/rend-spec.txt	2007-12-15 20:50:56 UTC (rev 12826)
@@ -547,10 +547,7 @@
    6 nodes. If the request is unsuccessful, Alice retries the other
    remaining responsible hidden service directories in a random order.
    Alice relies on Bob to care about a potential clock skew between the two
-   by possibly storing two sets of descriptors (see section 1.4).
-   [XXX what does this mean Bob does in practice, if anything? -RD]
-   [Cf. last sentence of 1.4. Maybe this reference would be helpful here,
-    so I added it. -KL]
+   by possibly storing two sets of descriptors (see end of section 1.4).
 
    Alice's OP opens a stream via Tor to the chosen v2 hidden service
    directory. (She may re-use old circuits for this.) Over this stream,

Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2007-12-15 20:28:09 UTC (rev 12825)
+++ tor/trunk/src/or/directory.c	2007-12-15 20:50:56 UTC (rev 12826)
@@ -3107,10 +3107,7 @@
 /** Determine the responsible hidden service directories for the
  * rend_encoded_v2_service_descriptor_t's in <b>descs</b> and upload them;
  * <b>service_id</b> and <b>seconds_valid</b> are only passed for logging
- * purposes.*/
-/* XXXX020 desc_ids and desc_strs could be merged.  Should they? */
-/* I guess they should. -KL */
-/* And now they are. -KL */
+ * purposes. */
 void
 directory_post_to_hs_dir(smartlist_t *descs, const char *service_id,
                          int seconds_valid)

Modified: tor/trunk/src/or/rendcommon.c
===================================================================
--- tor/trunk/src/or/rendcommon.c	2007-12-15 20:28:09 UTC (rev 12825)
+++ tor/trunk/src/or/rendcommon.c	2007-12-15 20:50:56 UTC (rev 12826)
@@ -320,7 +320,7 @@
 rend_encoded_v2_service_descriptor_free(
   rend_encoded_v2_service_descriptor_t *desc)
 {
-  if (desc->desc_str) tor_free(desc->desc_str);
+  tor_free(desc->desc_str);
   tor_free(desc);
 }
 

Modified: tor/trunk/src/or/rendservice.c
===================================================================
--- tor/trunk/src/or/rendservice.c	2007-12-15 20:28:09 UTC (rev 12825)
+++ tor/trunk/src/or/rendservice.c	2007-12-15 20:50:56 UTC (rev 12826)
@@ -325,13 +325,7 @@
         version = atoi(version_str);
         versions_bitmask |= 1 << version;
       }
-      /* XXX020 Karsten: do you really want to overwrite the
-       * descriptor_version in the second line? Perhaps if both bits
-       * are set you want to leave it at -1? -RD */
-      /* If both bits are set, versions_bitmask will be (1<<0) + (1<<2),
-       * so that neither condition will be true, leaving descriptor_version
-       * set to -1. Does the following comment make it less confusing? -KL */
-      /* If version 0 XOR 2 was set, change descriptor_version to that
+      /* If exactly one version is set, change descriptor_version to that
        * value; otherwise leave it at -1. */
       if (versions_bitmask == 1 << 0) service->descriptor_version = 0;
       if (versions_bitmask == 1 << 2) service->descriptor_version = 2;
@@ -1114,6 +1108,7 @@
       if (seconds_valid < 0) {
         log_warn(LD_BUG, "Internal error: couldn't encode service descriptor; "
                  "not uploading.");
+        smartlist_free(descs);
         return;
       }
       /* Post the current descriptors to the hidden service directories. */
@@ -1122,7 +1117,7 @@
                    serviceid);
       directory_post_to_hs_dir(descs, serviceid, seconds_valid);
       /* Free memory for descriptors. */
-      for (i = 0; i < REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS; i++)
+      for (i = 0; i < smartlist_len(descs); i++)
         rend_encoded_v2_service_descriptor_free(smartlist_get(descs, i));
       smartlist_clear(descs);
       /* Update next upload time. */
@@ -1141,14 +1136,15 @@
         if (seconds_valid < 0) {
           log_warn(LD_BUG, "Internal error: couldn't encode service "
                    "descriptor; not uploading.");
+          smartlist_free(descs);
           return;
         }
         directory_post_to_hs_dir(descs, serviceid, seconds_valid);
         /* Free memory for descriptors. */
-        for (i = 0; i < REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS; i++)
+        for (i = 0; i < smartlist_len(descs); i++)
           rend_encoded_v2_service_descriptor_free(smartlist_get(descs, i));
-        smartlist_free(descs);
       }
+      smartlist_free(descs);
       uploaded = 1;
       log_info(LD_REND, "Successfully uploaded v2 rend descriptors!");
     }



More information about the tor-commits mailing list