Sfoglia il codice sorgente

cleanups on r12825

svn:r12826
Roger Dingledine 16 anni fa
parent
commit
71c84abdff
4 ha cambiato i file con 9 aggiunte e 19 eliminazioni
  1. 1 4
      doc/spec/rend-spec.txt
  2. 1 4
      src/or/directory.c
  3. 1 1
      src/or/rendcommon.c
  4. 6 10
      src/or/rendservice.c

+ 1 - 4
doc/spec/rend-spec.txt

@@ -547,10 +547,7 @@ $Id$
    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,

+ 1 - 4
src/or/directory.c

@@ -3107,10 +3107,7 @@ dir_split_resource_into_fingerprints(const char *resource,
 /** 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)

+ 1 - 1
src/or/rendcommon.c

@@ -320,7 +320,7 @@ void
 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);
 }
 

+ 6 - 10
src/or/rendservice.c

@@ -325,13 +325,7 @@ rend_config_services(or_options_t *options, int validate_only)
         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 @@ upload_service_descriptor(rend_service_t *service)
       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 @@ upload_service_descriptor(rend_service_t *service)
                    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 @@ upload_service_descriptor(rend_service_t *service)
         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!");
     }