PLURAL(HiddenServiceExcludeNode),
PLURAL(RendNode),
PLURAL(RendExcludeNode),
- { "l", "LogLevel" , 1},
+ { "l", "LogLevel", 1},
+ { "BandwidthRate", "BandwidthRateBytes", 1},
+ { "BandwidthBurst", "BandwidthBurstBytes", 1},
{ NULL, NULL , 0},
};
#undef PLURAL
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),
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;
}
}
}
-/** 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. */
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);
}
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. */
* 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. */
}
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 */