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/hibernate.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/hibernate.c')
-rw-r--r-- | src/or/hibernate.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/hibernate.c b/src/or/hibernate.c index 2be95cb3c4..65ad4c80f3 100644 --- a/src/or/hibernate.c +++ b/src/or/hibernate.c @@ -581,7 +581,9 @@ accounting_record_bandwidth_usage(time_t now, or_state_t *state) ROUND_UP(n_bytes_written_in_interval); state->AccountingSecondsActive = n_seconds_active_in_interval; state->AccountingExpectedUsage = expected_bandwidth_usage; - or_state_mark_dirty(state, now+60); + + or_state_mark_dirty(state, + now+(get_options()->AvoidDiskWrites ? 7200 : 60)); return r; } @@ -767,7 +769,9 @@ hibernate_begin(int new_state, time_t now) hibernate_state = new_state; accounting_record_bandwidth_usage(now, get_or_state()); - or_state_mark_dirty(get_or_state(), 0); + + or_state_mark_dirty(get_or_state(), + get_options()->AvoidDiskWrites ? now+600 : 0); } /** Called when we've been hibernating and our timeout is reached. */ @@ -835,7 +839,9 @@ hibernate_go_dormant(time_t now) } accounting_record_bandwidth_usage(now, get_or_state()); - or_state_mark_dirty(get_or_state(), 0); + + or_state_mark_dirty(get_or_state(), + get_options()->AvoidDiskWrites ? now+600 : 0); } /** Called when hibernate_end_time has arrived. */ |