diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-03-12 22:48:18 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-03-12 22:48:18 +0000 |
commit | 474c60b7433da2302c35832571f41867714d8f65 (patch) | |
tree | 630b53f7fdd65de04d7a8735262221f5d419bf4a /src/or/hibernate.c | |
parent | b67a5ba49801a0a4e190036a30cd0b3d622de9ef (diff) | |
download | tor-474c60b7433da2302c35832571f41867714d8f65.tar.gz tor-474c60b7433da2302c35832571f41867714d8f65.zip |
Cleanup on time-relaqted constants. New conventions:
1) Surround all constants by (parens), whether we'll be using them
in a denominator or not.
2) Express all time periods as products (24*60*60), not as multiplied-out
constants (86400).
3) Comments like "(60*60) /* one hour */" are as pointless as comments
like "c = a + b; /* set c to the sum of a and b */". Remove them.
4) All time periods should be #defined constants, not given inline.
5) All time periods should have doxygen comments.
6) All time periods, unless specified, are in seconds. It's not necessary
to say so.
To summarize, the old (lack of) style would allow:
#define FOO_RETRY_INTERVAL 60*60 /* one hour (seconds) */
next_try = now + 3600;
The new style is:
/** How often do we reattempt foo? */
#define FOO_RETRY_INTERVAL (60*60)
next_try = now + RETRY_INTERVAL;
svn:r6142
Diffstat (limited to 'src/or/hibernate.c')
-rw-r--r-- | src/or/hibernate.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/hibernate.c b/src/or/hibernate.c index ffd06a96b3..a8128f45e9 100644 --- a/src/or/hibernate.c +++ b/src/or/hibernate.c @@ -430,6 +430,10 @@ accounting_run_housekeeping(time_t now) } } +/** When we have no idea how fast we are, how long do we assume it will take + * us to exhaust our bandwidth? */ +#define GUESS_TIME_TO_USE_BANDWIDTH (24*60*60) + /** Based on our interval and our estimated bandwidth, choose a * deterministic (but random-ish) time to wake up. */ static void @@ -463,7 +467,7 @@ accounting_set_wakeup_time(void) char buf2[ISO_TIME_LEN+1]; format_local_iso_time(buf1, interval_start_time); format_local_iso_time(buf2, interval_end_time); - time_to_exhaust_bw = 24*60*60; + time_to_exhaust_bw = GUESS_TIME_TO_USE_BANDWIDTH; interval_wakeup_time = interval_start_time; log_notice(LD_ACCT, |