aboutsummaryrefslogtreecommitdiff
path: root/src/or/hibernate.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-11-20 00:37:00 +0000
committerNick Mathewson <nickm@torproject.org>2004-11-20 00:37:00 +0000
commit8acaf8e1872f711898e850687ccf55a196dc1312 (patch)
tree71991ac1c30547461a6c17fbbbbe4ef5ee6a809e /src/or/hibernate.c
parentaa9461f13a9a0489da7bdb169d07ac18265ca817 (diff)
downloadtor-8acaf8e1872f711898e850687ccf55a196dc1312.tar.gz
tor-8acaf8e1872f711898e850687ccf55a196dc1312.zip
Add "MEMUNIT" and "INTERVAL" types to configuration. Also tweak Accounting setup. More docs needed
svn:r2911
Diffstat (limited to 'src/or/hibernate.c')
-rw-r--r--src/or/hibernate.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 7bff2934d8..054b96e00f 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -95,7 +95,7 @@ static void accounting_set_wakeup_time(void);
* hibernate, return 1, else return 0.
*/
int accounting_is_enabled(or_options_t *options) {
- if (options->AccountingMaxKB)
+ if (options->AccountingMax)
return 1;
return 0;
}
@@ -205,13 +205,13 @@ static void
update_expected_bandwidth(void)
{
uint64_t used;
- uint32_t max_configured = (get_options()->BandwidthRateBytes * 60);
+ uint32_t max_configured = (get_options()->BandwidthRate * 60);
if (n_seconds_active_in_interval < 1800) {
/* If we haven't gotten enough data last interval, guess that
* we'll be used at our maximum capacity. This is unlikely to be
* so, but it will give us an okay first estimate, and we'll stay
- * up until we send MaxKB kilobytes. Next interval, we'll choose
+ * up until we send Max ytes. Next interval, we'll choose
* our starting time based on how much we sent this interval.
*/
expected_bandwidth_usage = max_configured;
@@ -302,7 +302,7 @@ accounting_set_wakeup_time(void)
if (expected_bandwidth_usage)
n_days_to_exhaust_bw =
- (get_options()->AccountingMaxKB/expected_bandwidth_usage)/(24*60);
+ (get_options()->AccountingMax/expected_bandwidth_usage)/(24*60);
else
n_days_to_exhaust_bw = 1;
@@ -442,7 +442,7 @@ read_bandwidth_usage(void)
static int
hibernate_hard_limit_reached(void)
{
- uint64_t hard_limit = get_options()->AccountingMaxKB<<10;
+ uint64_t hard_limit = get_options()->AccountingMax;
if (!hard_limit)
return 0;
return n_bytes_read_in_interval >= hard_limit
@@ -453,7 +453,7 @@ hibernate_hard_limit_reached(void)
* to send/receive this interval. */
static int hibernate_soft_limit_reached(void)
{
- uint64_t soft_limit = (uint64_t) ((get_options()->AccountingMaxKB<<10) * .99);
+ uint64_t soft_limit = (uint64_t) ((get_options()->AccountingMax) * .99);
if (!soft_limit)
return 0;
return n_bytes_read_in_interval >= soft_limit
@@ -582,7 +582,7 @@ hibernate_end_time_elapsed(time_t now)
* to start/stop hibernating.
*/
void consider_hibernation(time_t now) {
- int accounting_enabled = get_options()->AccountingMaxKB != 0;
+ int accounting_enabled = get_options()->AccountingMax != 0;
char buf[ISO_TIME_LEN+1];
/* If we're in 'exiting' mode, then we just shut down after the interval