[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Try to make max_dl_per_request a bit smarter



commit ac9b0a3110ea4eea63133c6d2e3572b2cfd22bd6
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Sep 29 10:56:38 2014 -0400

    Try to make max_dl_per_request a bit smarter
---
 src/or/routerlist.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index e0a55d8..6b1baca 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -4358,21 +4358,25 @@ MOCK_IMPL(STATIC void, initiate_descriptor_downloads,
   tor_free(resource);
 }
 
-/** Max amount of hashes to download per request.
- * Since squid does not like URLs >= 4096 bytes we limit it to 96.
- *   4096 - strlen(http://255.255.255.255/tor/server/d/.z) == 4058
- *   4058/41 (40 for the hash and 1 for the + that separates them) => 98
- *   So use 96 because it's a nice number.
+/** Return the max number of hashes to put in a URL for a given request.
  */
 static int
 max_dl_per_request(const or_options_t *options, int purpose)
 {
+  /* Since squid does not like URLs >= 4096 bytes we limit it to 96.
+   *   4096 - strlen(http://255.255.255.255/tor/server/d/.z) == 4058
+   *   4058/41 (40 for the hash and 1 for the + that separates them) => 98
+   *   So use 96 because it's a nice number.
+   */
   int max = 96;
   if (purpose == DIR_PURPOSE_FETCH_MICRODESC) {
     max = 92;
   }
-  if (options->TunnelDirConns) {
-    max = 1000;
+  /* If we're going to tunnel our connections, we can ask for a lot more
+   * in a request. */
+  if (options->TunnelDirConns &&
+      !directory_fetches_from_authorities(options)) {
+    max = 500;
   }
   return max;
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits