diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-09-29 10:56:38 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-29 10:56:38 -0400 |
commit | ac9b0a3110ea4eea63133c6d2e3572b2cfd22bd6 (patch) | |
tree | f769b8b54105f47f09bbb91a43750e51aec89851 /src | |
parent | fa80983e52cd5213ca2019024eafdc846a720f99 (diff) | |
download | tor-ac9b0a3110ea4eea63133c6d2e3572b2cfd22bd6.tar.gz tor-ac9b0a3110ea4eea63133c6d2e3572b2cfd22bd6.zip |
Try to make max_dl_per_request a bit smarter
Diffstat (limited to 'src')
-rw-r--r-- | src/or/routerlist.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index e0a55d898f..6b1bacae74 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; } |