aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-02-03 22:58:22 +0000
committerRoger Dingledine <arma@torproject.org>2005-02-03 22:58:22 +0000
commitefa9bb55351e54026e66d9b28eec14f143e62544 (patch)
treea8fb83f2b79040edf8ef1310eac6c159f1dbeb75 /src
parenta035032f09de213ae7f3137cfd3262067f4635a5 (diff)
downloadtor-efa9bb55351e54026e66d9b28eec14f143e62544.tar.gz
tor-efa9bb55351e54026e66d9b28eec14f143e62544.zip
fix the latest bug: don't explode when some router declares a
bandwidthburst of 500 gigabytes. this bug seems to have taken down most of the network. oops. svn:r3523
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c6
-rw-r--r--src/or/connection.c5
-rw-r--r--src/or/connection_or.c4
3 files changed, 8 insertions, 7 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 41f8c3f1ec..a7d29a49dc 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -97,7 +97,7 @@ static config_var_t config_vars[] = {
VAR("AllowUnverifiedNodes",CSV, AllowUnverifiedNodes, "middle,rendezvous"),
VAR("AuthoritativeDirectory",BOOL, AuthoritativeDir, "0"),
VAR("BandwidthRate", MEMUNIT, BandwidthRate, "1 MB"),
- VAR("BandwidthBurst", MEMUNIT, BandwidthBurst, "48 MB"),
+ VAR("BandwidthBurst", MEMUNIT, BandwidthBurst, "5 MB"),
VAR("ClientOnly", BOOL, ClientOnly, "0"),
VAR("ContactInfo", STRING, ContactInfo, NULL),
VAR("ControlPort", UINT, ControlPort, "0"),
@@ -1414,11 +1414,11 @@ options_validate(or_options_t *options)
log(LOG_WARN,"BandwidthBurst must be at least equal to BandwidthRate.");
result = -1;
}
+#if 0
if (2*options->BandwidthRate > options->BandwidthBurst) {
log(LOG_NOTICE,"You have chosen a BandwidthBurst less than twice BandwidthRate. Please consider setting your BandwidthBurst higher (at least %d), to provide better service to the Tor network.", (int)(2*options->BandwidthRate));
- result = -1;
}
-
+#endif
if (options->_MonthlyAccountingStart) {
if (options->AccountingStart) {
diff --git a/src/or/connection.c b/src/or/connection.c
index fb71291ca1..cf42edba81 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -814,7 +814,7 @@ void connection_bucket_refill(struct timeval *now) {
conn = carray[i];
if (connection_receiver_bucket_should_increase(conn)) {
- conn->receiver_bucket += conn->bandwidth;
+ conn->receiver_bucket = conn->bandwidth;
//log_fn(LOG_DEBUG,"Receiver bucket %d now %d.", i, conn->receiver_bucket);
}
@@ -848,8 +848,7 @@ static int connection_receiver_bucket_should_increase(connection_t *conn) {
if (conn->state != OR_CONN_STATE_OPEN)
return 0; /* only open connections play the rate limiting game */
- tor_assert(conn->bandwidth > 0);
- if (conn->receiver_bucket > 9*conn->bandwidth)
+ if (conn->receiver_bucket >= conn->bandwidth)
return 0;
return 1;
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 98c1f3bcb8..aa0e624efc 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -114,9 +114,11 @@ int connection_or_finished_connecting(connection_t *conn)
*/
static void
connection_or_init_conn_from_router(connection_t *conn, routerinfo_t *router) {
+ or_options_t *options = get_options();
+
conn->addr = router->addr;
conn->port = router->or_port;
- conn->receiver_bucket = conn->bandwidth = router->bandwidthburst;
+ conn->receiver_bucket = conn->bandwidth = (int)options->BandwidthBurst;
conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey);
crypto_pk_get_digest(conn->identity_pkey, conn->identity_digest);
conn->nickname = tor_strdup(router->nickname);