]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make FetchUselessDescriptors fetch all desc types
authorNick Mathewson <nickm@torproject.org>
Mon, 29 Aug 2011 15:18:06 +0000 (11:18 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 29 Aug 2011 15:18:06 +0000 (11:18 -0400)
Previously, if you were set up to use microdescriptors, and you
weren't a cache, you'd never fetch router descriptors (except for
bridges).  Now FetchUselessDescriptors causes descriptors and
mirodescs to get cached.  Also, FetchUselessDescriptors changes the
behavior of "UseMicrodescriptors auto" to be off, since there's no
point in saying "UseMicrodescriptors 1" when you have full descriptors
too.

Fix for bug 3851; bugfix on 0.2.3.1-alpha.

changes/bug3851 [new file with mode: 0644]
src/or/microdesc.c
src/or/networkstatus.c

diff --git a/changes/bug3851 b/changes/bug3851
new file mode 100644 (file)
index 0000000..91572f0
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes:
+    - Make 'FetchUselessDescriptors' cause all descriptor types and
+      all consensus types get fetched. Fixes bug 3851; bugfix on
+      0.2.3.1-alpha.
index 627fad58e1220408029976a57f0d8a472ed1b4c5..510b2f40f7652f2998a78c74272a67d3b731c1a2 100644 (file)
@@ -698,8 +698,9 @@ we_use_microdescriptors_for_circuits(const or_options_t *options)
   int ret = options->UseMicrodescriptors;
   if (ret == -1) {
     /* UseMicrodescriptors is "auto"; we need to decide: */
-    /* So we decide that we'll use microdescriptors iff we are not a server */
-    ret = ! server_mode(options);
+    /* So we decide that we'll use microdescriptors iff we are not a server,
+     * and we're not autofetching everything. */
+    ret = !server_mode(options) && !options->FetchUselessDescriptors;
   }
   return ret;
 }
@@ -710,6 +711,8 @@ we_fetch_microdescriptors(const or_options_t *options)
 {
   if (directory_caches_dir_info(options))
     return 1;
+  if (options->FetchUselessDescriptors)
+    return 1;
   return we_use_microdescriptors_for_circuits(options);
 }
 
@@ -719,6 +722,8 @@ we_fetch_router_descriptors(const or_options_t *options)
 {
   if (directory_caches_dir_info(options))
     return 1;
+  if (options->FetchUselessDescriptors)
+    return 1;
   return ! we_use_microdescriptors_for_circuits(options);
 }
 
index 868c2a2a72ae4c7efefcb730619fb28b93dff2c3..398f041532cf306bef9909b72e66f069649198cd 100644 (file)
@@ -1187,6 +1187,10 @@ we_want_to_fetch_flavor(const or_options_t *options, int flavor)
      * it ourselves. */
     return 1;
   }
+  if (options->FetchUselessDescriptors) {
+    /* In order to get all descriptors, we need to fetch all consensuses. */
+    return 1;
+  }
   /* Otherwise, we want the flavor only if we want to use it to build
    * circuits. */
   return flavor == usable_consensus_flavor();