diff options
author | Roger Dingledine <arma@torproject.org> | 2004-11-04 03:25:43 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-11-04 03:25:43 +0000 |
commit | d0c158c8d69ead9c5d60011589bdf4d379aca208 (patch) | |
tree | 315483816c9e4300119e5c8349690bc806e5bac4 | |
parent | a4753283dd95a6399f65f8f439bad525702a08fc (diff) | |
download | tor-d0c158c8d69ead9c5d60011589bdf4d379aca208.tar tor-d0c158c8d69ead9c5d60011589bdf4d379aca208.tar.gz |
clarify the bandwidthburst and bandwidthrate are in bytes
(niels had thought they were in bits, or kb, or something)
svn:r2669
-rw-r--r-- | src/or/config.c | 12 | ||||
-rw-r--r-- | src/or/connection.c | 14 | ||||
-rw-r--r-- | src/or/connection_or.c | 2 | ||||
-rw-r--r-- | src/or/or.h | 8 | ||||
-rw-r--r-- | src/or/router.c | 4 |
5 files changed, 21 insertions, 19 deletions
diff --git a/src/or/config.c b/src/or/config.c index 6dadda1c4..ce9ed2e1c 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -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; } diff --git a/src/or/connection.c b/src/or/connection.c index 057606963..c996d6384 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -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); } diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 2852ad599..4b01778b6 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -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. */ diff --git a/src/or/or.h b/src/or/or.h index e69ff558d..648a18897 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -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. */ diff --git a/src/or/router.c b/src/or/router.c index 989e7aed9..b8fd748f2 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -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 */ |