clarify the bandwidthburst and bandwidthrate are in bytes

(niels had thought they were in bits, or kb, or something)


svn:r2669
This commit is contained in:
Roger Dingledine
2004-11-04 03:25:43 +00:00
parent a4753283dd
commit d0c158c8d6
5 changed files with 21 additions and 19 deletions
+7 -5
View File
@@ -47,7 +47,9 @@ static config_abbrev_t config_abbrevs[] = {
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 @@ static config_var_t config_vars[] = {
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 @@ init_options(or_options_t *options)
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;
}
+7 -7
View File
@@ -700,11 +700,11 @@ static void connection_read_bucket_decrement(connection_t *conn, int num_read) {
}
}
/** 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 @@ void connection_bucket_refill(struct timeval *now) {
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);
}
+1 -1
View File
@@ -132,7 +132,7 @@ connection_or_init_conn_from_address(connection_t *conn,
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. */
+4 -4
View File
@@ -922,10 +922,10 @@ typedef struct {
* 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. */
+2 -2
View File
@@ -540,8 +540,8 @@ int router_rebuild_descriptor(void) {
}
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 */