[or-cvs] clarify the bandwidthburst and bandwidthrate are in bytes
Roger Dingledine
arma at seul.org
Thu Nov 4 03:25:46 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
config.c connection.c connection_or.c or.h router.c
Log Message:
clarify the bandwidthburst and bandwidthrate are in bytes
(niels had thought they were in bits, or kb, or something)
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -d -r1.199 -r1.200
--- config.c 3 Nov 2004 23:13:28 -0000 1.199
+++ config.c 4 Nov 2004 03:25:43 -0000 1.200
@@ -47,7 +47,9 @@
PLURAL(HiddenServiceExcludeNode),
PLURAL(RendNode),
PLURAL(RendExcludeNode),
- { "l", "LogLevel" , 1},
+ { "l", "LogLevel", 1},
+ { "BandwidthRate", "BandwidthRateBytes", 1},
+ { "BandwidthBurst", "BandwidthBurstBytes", 1},
{ NULL, NULL , 0},
};
#undef PLURAL
@@ -79,8 +81,8 @@
VAR("Address", STRING, Address, NULL),
VAR("AllowUnverifiedNodes",CSV, AllowUnverifiedNodes, NULL),
VAR("AuthoritativeDirectory",BOOL, AuthoritativeDir, "0"),
- VAR("BandwidthRate", UINT, BandwidthRate, "800000"),
- VAR("BandwidthBurst", UINT, BandwidthBurst, "50000000"),
+ VAR("BandwidthRateBytes", UINT, BandwidthRateBytes, "800000"),
+ VAR("BandwidthBurstBytes", UINT, BandwidthBurstBytes, "50000000"),
VAR("ClientOnly", BOOL, ClientOnly, "0"),
VAR("ContactInfo", STRING, ContactInfo, NULL),
VAR("DebugLogFile", STRING, DebugLogFile, NULL),
@@ -663,8 +665,8 @@
options->KeepalivePeriod = 300;
options->MaxOnionsPending = 100;
options->NewCircuitPeriod = 30; /* twice a minute */
- options->BandwidthRate = 800000; /* at most 800kB/s total sustained incoming */
- options->BandwidthBurst = 10000000; /* max burst on the token bucket */
+ options->BandwidthRateBytes = 800000; /* at most 800kB/s total sustained incoming */
+ options->BandwidthBurstBytes = 10000000; /* max burst on the token bucket */
options->NumCpus = 1;
}
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.280
retrieving revision 1.281
diff -u -d -r1.280 -r1.281
--- connection.c 3 Nov 2004 23:13:28 -0000 1.280
+++ connection.c 4 Nov 2004 03:25:43 -0000 1.281
@@ -700,11 +700,11 @@
}
}
-/** Initiatialize the global read bucket to options.BandwidthBurst,
+/** Initiatialize the global read bucket to options.BandwidthBurstBytes,
* and current_time to the current time. */
void connection_bucket_init(void) {
- global_read_bucket = options.BandwidthBurst; /* start it at max traffic */
- global_write_bucket = options.BandwidthBurst; /* start it at max traffic */
+ global_read_bucket = options.BandwidthBurstBytes; /* start it at max traffic */
+ global_write_bucket = options.BandwidthBurstBytes; /* start it at max traffic */
}
/** A second has rolled over; increment buckets appropriately. */
@@ -714,12 +714,12 @@
connection_t **carray;
/* refill the global buckets */
- if(global_read_bucket < options.BandwidthBurst) {
- global_read_bucket += options.BandwidthRate;
+ if(global_read_bucket < options.BandwidthBurstBytes) {
+ global_read_bucket += options.BandwidthRateBytes;
log_fn(LOG_DEBUG,"global_read_bucket now %d.", global_read_bucket);
}
- if(global_write_bucket < options.BandwidthBurst) {
- global_write_bucket += options.BandwidthRate;
+ if(global_write_bucket < options.BandwidthBurstBytes) {
+ global_write_bucket += options.BandwidthRateBytes;
log_fn(LOG_DEBUG,"global_write_bucket now %d.", global_write_bucket);
}
Index: connection_or.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_or.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- connection_or.c 3 Nov 2004 18:33:07 -0000 1.132
+++ connection_or.c 4 Nov 2004 03:25:43 -0000 1.133
@@ -132,7 +132,7 @@
conn->addr = addr;
conn->port = port;
/* This next part isn't really right, but it's good enough for now. */
- conn->receiver_bucket = conn->bandwidth = options.BandwidthBurst;
+ conn->receiver_bucket = conn->bandwidth = options.BandwidthBurstBytes;
memcpy(conn->identity_digest, id_digest, DIGEST_LEN);
/* If we're an authoritative directory server, we may know a
* nickname for this router. */
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.457
retrieving revision 1.458
diff -u -d -r1.457 -r1.458
--- or.h 3 Nov 2004 19:49:03 -0000 1.457
+++ or.h 4 Nov 2004 03:25:43 -0000 1.458
@@ -922,10 +922,10 @@
* them? */
int NewCircuitPeriod; /**< How long do we use a circuit before building
* a new one? */
- int BandwidthRate; /**< How much bandwidth, on average, are we willing to
- * use in a second? */
- int BandwidthBurst; /**< How much bandwidth, at maximum, are we willing to
- * use in a second? */
+ int BandwidthRateBytes; /**< How much bandwidth, on average, are we willing to
+ * use in a second? */
+ int BandwidthBurstBytes; /**< How much bandwidth, at maximum, are we willing to
+ * use in a second? */
int NumCpus; /**< How many CPUs should we try to use? */
int RunTesting; /**< If true, create testing circuits to measure how well the
* other ORs are running. */
Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- router.c 3 Nov 2004 18:33:07 -0000 1.108
+++ router.c 4 Nov 2004 03:25:43 -0000 1.109
@@ -540,8 +540,8 @@
}
get_platform_str(platform, sizeof(platform));
ri->platform = tor_strdup(platform);
- ri->bandwidthrate = options.BandwidthRate;
- ri->bandwidthburst = options.BandwidthBurst;
+ ri->bandwidthrate = options.BandwidthRateBytes;
+ ri->bandwidthburst = options.BandwidthBurstBytes;
ri->bandwidthcapacity = router_get_bandwidth_capacity();
router_add_exit_policy_from_config(ri);
if(desc_routerinfo) /* inherit values */
More information about the tor-commits
mailing list