diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-12-24 02:45:46 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-12-24 02:45:46 +0000 |
commit | bba5a3533f1413601c04a8f61ab0662b77fe7e2b (patch) | |
tree | 906f5a9e23837b5b7f718d20415802aa8b90494a /src/or/rephist.c | |
parent | a9dc42e3815ff49f469d37039df83fb2db6fa73e (diff) | |
download | tor-bba5a3533f1413601c04a8f61ab0662b77fe7e2b.tar.gz tor-bba5a3533f1413601c04a8f61ab0662b77fe7e2b.zip |
r11679@Kushana: nickm | 2006-12-23 21:38:41 -0500
Update the state file less often when AvoidDiskWrites is set.
svn:r9174
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r-- | src/or/rephist.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c index c30583fe58..7b13d124bc 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -669,8 +669,11 @@ rep_hist_update_state(or_state_t *state) * force these values to the defaults. */ /* FFFF we should pull the default out of config.c's state table, * so we don't have two defaults. */ - if (*s_begins != 0 || *s_interval != 900) - or_state_mark_dirty(get_or_state(), time(NULL)+600); + if (*s_begins != 0 || *s_interval != 900) { + time_t now = time(NULL); + time_t save_at = get_options()->AvoidDiskWrites ? now+3600 : now+600; + or_state_mark_dirty(state, save_at); + } *s_begins = 0; *s_interval = 900; *s_values = smartlist_create(); @@ -687,8 +690,9 @@ rep_hist_update_state(or_state_t *state) smartlist_split_string(*s_values, buf, ",", SPLIT_SKIP_SPACE, 0); } tor_free(buf); - if (server_mode(get_options())) + if (server_mode(get_options())) { or_state_mark_dirty(get_or_state(), time(NULL)+(2*3600)); + } } /** Set bandwidth history from our saved state. */ |