[or-cvs] backport the bandwidthburts bugfix.

Roger Dingledine arma at seul.org
Thu Feb 3 23:05:42 UTC 2005


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

Modified Files:
      Tag: tor-0_0_9-patches
	config.c connection.c connection_or.c 
Log Message:
backport the bandwidthburts bugfix.


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.286.2.5
retrieving revision 1.286.2.6
diff -u -d -r1.286.2.5 -r1.286.2.6
--- config.c	28 Jan 2005 08:44:10 -0000	1.286.2.5
+++ config.c	3 Feb 2005 23:05:39 -0000	1.286.2.6
@@ -95,8 +95,8 @@
   VAR("AccountingStart",     STRING,   AccountingStart,      NULL),
   VAR("AllowUnverifiedNodes",CSV,      AllowUnverifiedNodes, "middle,rendezvous"),
   VAR("AuthoritativeDirectory",BOOL,   AuthoritativeDir,     "0"),
-  VAR("BandwidthRate",       MEMUNIT,  BandwidthRate,        "780 KB"),
-  VAR("BandwidthBurst",      MEMUNIT,  BandwidthBurst,       "48 MB"),
+  VAR("BandwidthRate",       MEMUNIT,  BandwidthRate,        "1 MB"),
+  VAR("BandwidthBurst",      MEMUNIT,  BandwidthBurst,       "5 MB"),
   VAR("ClientOnly",          BOOL,     ClientOnly,           "0"),
   VAR("ContactInfo",         STRING,   ContactInfo,          NULL),
   VAR("ControlPort",         UINT,     ControlPort,          "0"),

Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.310.2.2
retrieving revision 1.310.2.3
diff -u -d -r1.310.2.2 -r1.310.2.3
--- connection.c	3 Jan 2005 21:24:06 -0000	1.310.2.2
+++ connection.c	3 Feb 2005 23:05:39 -0000	1.310.2.3
@@ -778,7 +778,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);
     }
 
@@ -813,7 +813,7 @@
     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.150.2.2
retrieving revision 1.150.2.3
diff -u -d -r1.150.2.2 -r1.150.2.3
--- connection_or.c	3 Jan 2005 17:54:29 -0000	1.150.2.2
+++ connection_or.c	3 Feb 2005 23:05:39 -0000	1.150.2.3
@@ -111,9 +111,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);



More information about the tor-commits mailing list