aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2011-04-28 21:06:25 -0400
committerRoger Dingledine <arma@torproject.org>2011-04-28 21:06:25 -0400
commit66de6f7eb8e2948f6c3849dbca20c7b31969b5b7 (patch)
tree1cb3805c697f153a490085b568a522401c24be69 /src
parent5693fedb60ee19048d45ed892edb07925b52678b (diff)
downloadtor-66de6f7eb8e2948f6c3849dbca20c7b31969b5b7.tar
tor-66de6f7eb8e2948f6c3849dbca20c7b31969b5b7.tar.gz
relays checkpoint their state file twice a day
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 9384b3a68..dc2414048 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -5122,6 +5122,11 @@ or_state_load(void)
/** If writing the state to disk fails, try again after this many seconds. */
#define STATE_WRITE_RETRY_INTERVAL 3600
+/** If we're a relay, how often should we checkpoint our state file even
+ * if nothing else dirties it? This will checkpoint ongoing stats like
+ * bandwidth used, per-country user stats, etc. */
+#define STATE_RELAY_CHECKPOINT_INTERVAL (12*60*60)
+
/** Write the persistent state to disk. Return 0 for success, <0 on failure. */
int
or_state_save(time_t now)
@@ -5172,7 +5177,11 @@ or_state_save(time_t now)
tor_free(fname);
tor_free(contents);
- global_state->next_write = TIME_MAX;
+ if (server_mode(get_options()))
+ global_state->next_write = now + STATE_RELAY_CHECKPOINT_INTERVAL;
+ else
+ global_state->next_write = TIME_MAX;
+
return 0;
}