diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-12-07 20:11:30 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-12-07 20:11:30 +0000 |
commit | 7c79495137bcd3989428d65b184038aa71fbae70 (patch) | |
tree | a18217ed1dfeb55a8ba045772364d08837f20fbb /src/or/rephist.c | |
parent | c304a10fd3ec7943734d47c2e95fcd1b75bf526d (diff) | |
download | tor-7c79495137bcd3989428d65b184038aa71fbae70.tar.gz tor-7c79495137bcd3989428d65b184038aa71fbae70.zip |
r11468@Kushana: nickm | 2006-12-07 14:56:57 -0500
Revise logic used to flush state to disk. Now, we try to batch non-urgent changes so that we do not do too many writes, and we save very-non-urgent changes every once in a rare while, and we never save more than once per second.
svn:r9047
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r-- | src/or/rephist.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c index 20b76679bd..af295facf3 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -666,6 +666,8 @@ rep_hist_update_state(or_state_t *state) if (! server_mode(get_options())) { /* Clients don't need to store bandwidth history persistently; * force these values to the defaults. */ + if (*s_begins != 0 || *s_interval != 900) + or_state_mark_dirty(get_or_state(), time(NULL)+600); *s_begins = 0; *s_interval = 900; *s_values = smartlist_create(); @@ -682,7 +684,8 @@ rep_hist_update_state(or_state_t *state) smartlist_split_string(*s_values, buf, ",", SPLIT_SKIP_SPACE, 0); } tor_free(buf); - state->dirty = 1; + if (server_mode(get_options())) + or_state_mark_dirty(get_or_state(), time(NULL)+(2*3600)); } /** Set bandwidth history from our saved state. */ |