diff options
author | Peter Palfrader <peter@palfrader.org> | 2006-02-03 15:17:48 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2006-02-03 15:17:48 +0000 |
commit | 390bbb0a0c0d2d9db01689f7ef338d5946c15ab0 (patch) | |
tree | 27652766c244db384c360751c15455eb7eb6ec37 /src | |
parent | a1dd751f301268a30223a49436eccab3f2971f8c (diff) | |
download | tor-390bbb0a0c0d2d9db01689f7ef338d5946c15ab0.tar.gz tor-390bbb0a0c0d2d9db01689f7ef338d5946c15ab0.zip |
Try to make tor work better through squid: Limit number of descriptors we fetch
to 96 (was 128 previously).
We limit this number even when we do not have a http proxy explicitly
configured as some people mistakenly believe transparent proxies are a neat
idea.
svn:r5901
Diffstat (limited to 'src')
-rw-r--r-- | src/or/directory.c | 5 | ||||
-rw-r--r-- | src/or/routerlist.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 8210108a92..ed1ae55218 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -579,6 +579,11 @@ directory_send_command(connection_t *conn, const char *platform, tor_assert(0); return; } + + if (strlen(proxystring) + strlen(url) >= 4096) { + warn(LD_BUG,"Bug: squid does not like URLs longer than 4095 bytes, this one is %d bytes long: %s%s", strlen(proxystring) + strlen(url), proxystring, url); + } + tor_snprintf(request, sizeof(request), "%s %s", httpcommand, proxystring); connection_write_to_buf(request, strlen(request), conn); connection_write_to_buf(url, strlen(url), conn); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 66dbf8c93d..3ac9ee0490 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -3311,7 +3311,13 @@ router_list_client_downloadable(void) static void update_router_descriptor_client_downloads(time_t now) { -#define MAX_DL_PER_REQUEST 128 + /* 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. + */ +#define MAX_DL_PER_REQUEST 96 #define MIN_DL_PER_REQUEST 4 #define MIN_REQUESTS 3 #define MAX_DL_TO_DELAY 16 |