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

[or-cvs] fix the latest bug: don"t explode when some router declares a



Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs2/tor/src/or

Modified Files:
	config.c connection.c connection_or.c 
Log Message:
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.


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.308
retrieving revision 1.309
diff -u -d -r1.308 -r1.309
--- config.c	2 Feb 2005 01:59:16 -0000	1.308
+++ config.c	3 Feb 2005 22:58:22 -0000	1.309
@@ -97,7 +97,7 @@
   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 @@
     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) {

Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.321
retrieving revision 1.322
diff -u -d -r1.321 -r1.322
--- connection.c	1 Feb 2005 00:37:16 -0000	1.321
+++ connection.c	3 Feb 2005 22:58:22 -0000	1.322
@@ -814,7 +814,7 @@
     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 @@
   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;

Index: connection_or.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_or.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -d -r1.157 -r1.158
--- connection_or.c	1 Feb 2005 00:37:16 -0000	1.157
+++ connection_or.c	3 Feb 2005 22:58:22 -0000	1.158
@@ -114,9 +114,11 @@
  */
 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);