[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9421: never refuse directory requests from local addresses (in tor/trunk: . src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r9421: never refuse directory requests from local addresses (in tor/trunk: . src/or)
- From: arma@xxxxxxxx
- Date: Fri, 26 Jan 2007 03:01:32 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Fri, 26 Jan 2007 03:02:04 -0500
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: arma
Date: 2007-01-26 03:01:29 -0500 (Fri, 26 Jan 2007)
New Revision: 9421
Modified:
tor/trunk/ChangeLog
tor/trunk/src/or/connection.c
tor/trunk/src/or/directory.c
tor/trunk/src/or/or.h
Log:
never refuse directory requests from local addresses
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2007-01-26 07:54:16 UTC (rev 9420)
+++ tor/trunk/ChangeLog 2007-01-26 08:01:29 UTC (rev 9421)
@@ -3,6 +3,7 @@
- Servers decline directory requests much more aggressively when
they're low on bandwidth. Otherwise they end up queueing more and
more directory responses, which can't be good for latency.
+ - But never refuse directory requests from local addresses.
- Be willing to read or write on local connections (e.g. controller
connections) even when the global rate limiting buckets are empty.
- If our system clock jumps back in time, don't publish a negative
Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c 2007-01-26 07:54:16 UTC (rev 9420)
+++ tor/trunk/src/or/connection.c 2007-01-26 08:01:29 UTC (rev 9421)
@@ -1175,8 +1175,8 @@
}
/** Return 1 if the global write bucket is low enough that we shouldn't
- * send <b>attempt</b> bytes of low-priority directory stuff out.
- * Else return 0.
+ * send <b>attempt</b> bytes of low-priority directory stuff out to
+ * <b>conn</b>. Else return 0.
* Priority is 1 for v1 requests (directories and running-routers),
* and 2 for v2 requests (statuses and descriptors). But see FFFF in
@@ -1194,11 +1194,14 @@
* that's harder to quantify and harder to keep track of.
*/
int
-global_write_bucket_low(size_t attempt, int priority)
+global_write_bucket_low(connection_t *conn, size_t attempt, int priority)
{
if (authdir_mode(get_options()) && priority>1)
return 0; /* there's always room to answer v2 if we're an auth dir */
+ if (is_internal_IP(conn->addr, 0))
+ return 0; /* local conns don't get limited */
+
if (global_write_bucket < (int)attempt)
return 1; /* not enough space no matter the priority */
Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c 2007-01-26 07:54:16 UTC (rev 9420)
+++ tor/trunk/src/or/directory.c 2007-01-26 08:01:29 UTC (rev 9421)
@@ -1603,7 +1603,7 @@
}
dlen = deflated ? d->dir_z_len : d->dir_len;
- if (global_write_bucket_low(dlen, 1)) {
+ if (global_write_bucket_low(TO_CONN(conn), dlen, 1)) {
log_info(LD_DIRSERV,
"Client asked for the mirrored directory, but we've been "
"writing too many bytes lately. Sending 503 Dir busy.");
@@ -1645,7 +1645,7 @@
tor_free(url);
return 0;
}
- if (global_write_bucket_low(dlen, 1)) {
+ if (global_write_bucket_low(TO_CONN(conn), dlen, 1)) {
log_info(LD_DIRSERV,
"Client asked for running-routers, but we've been "
"writing too many bytes lately. Sending 503 Dir busy.");
@@ -1689,7 +1689,7 @@
return 0;
}
dlen = dirserv_estimate_data_size(dir_fps, 0, deflated);
- if (global_write_bucket_low(dlen, 2)) {
+ if (global_write_bucket_low(TO_CONN(conn), dlen, 2)) {
log_info(LD_DIRSERV,
"Client asked for network status lists, but we've been "
"writing too many bytes lately. Sending 503 Dir busy.");
@@ -1758,7 +1758,7 @@
else {
dlen = dirserv_estimate_data_size(conn->fingerprint_stack,
1, deflated);
- if (global_write_bucket_low(dlen, 2)) {
+ if (global_write_bucket_low(TO_CONN(conn), dlen, 2)) {
log_info(LD_DIRSERV,
"Client asked for server descriptors, but we've been "
"writing too many bytes lately. Sending 503 Dir busy.");
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2007-01-26 07:54:16 UTC (rev 9420)
+++ tor/trunk/src/or/or.h 2007-01-26 08:01:29 UTC (rev 9421)
@@ -2042,7 +2042,7 @@
smartlist_t *new_conns);
int connection_bucket_write_limit(connection_t *conn);
-int global_write_bucket_low(size_t attempt, int priority);
+int global_write_bucket_low(connection_t *conn, size_t attempt, int priority);
void connection_bucket_init(void);
void connection_bucket_refill(int seconds_elapsed);